timed_io_test.go 465 B

1234567891011121314151617181920
  1. package net_test
  2. import (
  3. "testing"
  4. . "github.com/v2ray/v2ray-core/common/net"
  5. v2testing "github.com/v2ray/v2ray-core/testing"
  6. "github.com/v2ray/v2ray-core/testing/assert"
  7. )
  8. func TestTimeOutSettings(t *testing.T) {
  9. v2testing.Current(t)
  10. reader := NewTimeOutReader(8, nil)
  11. assert.Int(reader.GetTimeOut()).Equals(8)
  12. reader.SetTimeOut(8) // no op
  13. assert.Int(reader.GetTimeOut()).Equals(8)
  14. reader.SetTimeOut(9)
  15. assert.Int(reader.GetTimeOut()).Equals(9)
  16. }