1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -05:00

refine kcp test

This commit is contained in:
Darien Raymond 2018-07-28 16:49:03 +02:00
parent e4176d7048
commit 95b24584bf
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -775,16 +775,20 @@ func TestVMessKCP(t *testing.T) {
servers, err := InitializeServerConfigs(serverConfig, clientConfig)
assert(err, IsNil)
defer CloseAllServers(servers)
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{
IP: []byte{127, 0, 0, 1},
Port: int(clientPort),
})
assert(err, IsNil)
defer conn.Close()
payload := make([]byte, 10240*1024)
rand.Read(payload)
@ -794,14 +798,12 @@ func TestVMessKCP(t *testing.T) {
assert(nBytes, Equals, len(payload))
response := readFrom(conn, time.Minute*2, 10240*1024)
assert(response, Equals, xor(payload))
assert(conn.Close(), IsNil)
wg.Done()
if err := compare.BytesEqualWithDetail(response, xor(payload)); err != nil {
t.Error(err)
}
}()
}
wg.Wait()
CloseAllServers(servers)
}
func TestVMessKCPLarge(t *testing.T) {