1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-22 07:25:23 +00:00

update wss test

This commit is contained in:
Darien Raymond 2018-11-13 20:55:34 +01:00
parent 29d978d157
commit eeb588ffa0
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -500,25 +500,33 @@ func TestTLSOverWebSocket(t *testing.T) {
} }
servers, err := InitializeServerConfigs(serverConfig, clientConfig) servers, err := InitializeServerConfigs(serverConfig, clientConfig)
assert(err, IsNil) common.Must(err)
defer CloseAllServers(servers)
conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{ var wg sync.WaitGroup
IP: []byte{127, 0, 0, 1}, for i := 0; i < 10; i++ {
Port: int(clientPort), wg.Add(1)
}) go func() {
assert(err, IsNil) defer wg.Done()
payload := make([]byte, 10240*1024) conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{
rand.Read(payload) IP: []byte{127, 0, 0, 1},
nBytes, err := conn.Write([]byte(payload)) Port: int(clientPort),
assert(err, IsNil) })
assert(nBytes, Equals, len(payload)) common.Must(err)
response := readFrom(conn, time.Second*20, len(payload)) payload := make([]byte, 10240*1024)
assert(response, Equals, xor([]byte(payload))) rand.Read(payload)
assert(conn.Close(), IsNil) nBytes, err := conn.Write([]byte(payload))
assert(err, IsNil)
assert(nBytes, Equals, len(payload))
CloseAllServers(servers) response := readFrom(conn, time.Second*20, len(payload))
assert(response, Equals, xor([]byte(payload)))
assert(conn.Close(), IsNil)
}()
}
wg.Wait()
} }
func TestHTTP2(t *testing.T) { func TestHTTP2(t *testing.T) {