mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
404 B
29 lines
404 B
8 years ago
|
package mux_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
. "v2ray.com/core/app/proxyman/mux"
|
||
|
"v2ray.com/core/testing/assert"
|
||
|
)
|
||
|
|
||
|
func TestSessionManagerAdd(t *testing.T) {
|
||
|
assert := assert.On(t)
|
||
|
|
||
|
m := NewSessionManager()
|
||
|
|
||
|
s := &Session{}
|
||
|
m.Allocate(s)
|
||
|
assert.Uint16(s.ID).Equals(1)
|
||
|
|
||
|
s = &Session{}
|
||
|
m.Allocate(s)
|
||
|
assert.Uint16(s.ID).Equals(2)
|
||
|
|
||
|
s = &Session{
|
||
|
ID: 4,
|
||
|
}
|
||
|
m.Add(s)
|
||
|
assert.Uint16(s.ID).Equals(4)
|
||
|
}
|