session_test.go 404 B

12345678910111213141516171819202122232425262728
  1. package mux_test
  2. import (
  3. "testing"
  4. . "v2ray.com/core/app/proxyman/mux"
  5. "v2ray.com/core/testing/assert"
  6. )
  7. func TestSessionManagerAdd(t *testing.T) {
  8. assert := assert.On(t)
  9. m := NewSessionManager()
  10. s := &Session{}
  11. m.Allocate(s)
  12. assert.Uint16(s.ID).Equals(1)
  13. s = &Session{}
  14. m.Allocate(s)
  15. assert.Uint16(s.ID).Equals(2)
  16. s = &Session{
  17. ID: 4,
  18. }
  19. m.Add(s)
  20. assert.Uint16(s.ID).Equals(4)
  21. }