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