1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-04 16:37:12 -05: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,13 +500,20 @@ func TestTLSOverWebSocket(t *testing.T) {
} }
servers, err := InitializeServerConfigs(serverConfig, clientConfig) servers, err := InitializeServerConfigs(serverConfig, clientConfig)
assert(err, IsNil) common.Must(err)
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{ 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) common.Must(err)
payload := make([]byte, 10240*1024) payload := make([]byte, 10240*1024)
rand.Read(payload) rand.Read(payload)
@ -517,8 +524,9 @@ func TestTLSOverWebSocket(t *testing.T) {
response := readFrom(conn, time.Second*20, len(payload)) response := readFrom(conn, time.Second*20, len(payload))
assert(response, Equals, xor([]byte(payload))) assert(response, Equals, xor([]byte(payload)))
assert(conn.Close(), IsNil) assert(conn.Close(), IsNil)
}()
CloseAllServers(servers) }
wg.Wait()
} }
func TestHTTP2(t *testing.T) { func TestHTTP2(t *testing.T) {