1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-26 17:35:23 +00:00

fix kcp test

This commit is contained in:
Darien Raymond 2017-02-07 23:33:21 +01:00
parent d2538839af
commit a0f2dabe5c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -3,11 +3,9 @@ package scenarios
import ( import (
"crypto/rand" "crypto/rand"
"net" "net"
"testing"
"time"
"sync" "sync"
"testing"
"time"
"v2ray.com/core" "v2ray.com/core"
"v2ray.com/core/app/log" "v2ray.com/core/app/log"
@ -634,8 +632,8 @@ func TestVMessKCP(t *testing.T) {
assert.Error(InitializeServerConfig(clientConfig)).IsNil() assert.Error(InitializeServerConfig(clientConfig)).IsNil()
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(10)
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
wg.Add(1)
go func() { go func() {
conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{ conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{
IP: []byte{127, 0, 0, 1}, IP: []byte{127, 0, 0, 1},
@ -650,7 +648,7 @@ func TestVMessKCP(t *testing.T) {
assert.Error(err).IsNil() assert.Error(err).IsNil()
assert.Int(nBytes).Equals(len(payload)) assert.Int(nBytes).Equals(len(payload))
response := readFrom(conn, time.Second*10, 10240*1024) response := readFrom(conn, time.Minute, 10240*1024)
assert.Bytes(response).Equals(xor([]byte(payload))) assert.Bytes(response).Equals(xor([]byte(payload)))
assert.Error(conn.Close()).IsNil() assert.Error(conn.Close()).IsNil()
wg.Done() wg.Done()