1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-24 14:14:35 -04:00
v2fly/transport/internet/kcp/connection_test.go
2016-07-12 13:27:12 +02:00

22 lines
459 B
Go

package kcp_test
import (
"testing"
"time"
"github.com/v2ray/v2ray-core/testing/assert"
. "github.com/v2ray/v2ray-core/transport/internet/kcp"
)
func TestConnectionReadTimeout(t *testing.T) {
assert := assert.On(t)
conn := NewConnection(1, nil, nil, nil, NewSimpleAuthenticator())
conn.SetReadDeadline(time.Now().Add(time.Second))
b := make([]byte, 1024)
nBytes, err := conn.Read(b)
assert.Int(nBytes).Equals(0)
assert.Error(err).IsNotNil()
}