mirror of https://github.com/v2ray/v2ray-core
avoid port in-use error in websocket test
parent
6c14ecb2a0
commit
054ceb865d
|
@ -67,7 +67,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||||
assert := With(t)
|
assert := With(t)
|
||||||
listen, err := ListenWS(internet.ContextWithTransportSettings(context.Background(), &Config{
|
listen, err := ListenWS(internet.ContextWithTransportSettings(context.Background(), &Config{
|
||||||
Path: "ws",
|
Path: "ws",
|
||||||
}), net.DomainAddress("localhost"), 13146, func(ctx context.Context, conn internet.Connection) bool {
|
}), net.DomainAddress("localhost"), 13148, func(ctx context.Context, conn internet.Connection) bool {
|
||||||
go func(c internet.Connection) {
|
go func(c internet.Connection) {
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||||
assert(err, IsNil)
|
assert(err, IsNil)
|
||||||
|
|
||||||
ctx := internet.ContextWithTransportSettings(context.Background(), &Config{Path: "ws", Header: []*Header{{Key: "X-Forwarded-For", Value: "1.1.1.1"}}})
|
ctx := internet.ContextWithTransportSettings(context.Background(), &Config{Path: "ws", Header: []*Header{{Key: "X-Forwarded-For", Value: "1.1.1.1"}}})
|
||||||
conn, err := Dial(ctx, net.TCPDestination(net.DomainAddress("localhost"), 13146))
|
conn, err := Dial(ctx, net.TCPDestination(net.DomainAddress("localhost"), 13148))
|
||||||
|
|
||||||
assert(err, IsNil)
|
assert(err, IsNil)
|
||||||
_, err = conn.Write([]byte("Test connection 1"))
|
_, err = conn.Write([]byte("Test connection 1"))
|
||||||
|
|
Loading…
Reference in New Issue