From acc6ea3e6beee3c9c963f99459c0f2437c7cfbc5 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Thu, 8 Feb 2018 16:39:18 +0100 Subject: [PATCH] fix websocket test --- transport/internet/websocket/ws_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/transport/internet/websocket/ws_test.go b/transport/internet/websocket/ws_test.go index 4f3c906c..1cb985b6 100644 --- a/transport/internet/websocket/ws_test.go +++ b/transport/internet/websocket/ws_test.go @@ -18,7 +18,7 @@ func Test_listenWSAndDial(t *testing.T) { assert := With(t) listen, err := ListenWS(internet.ContextWithTransportSettings(context.Background(), &Config{ Path: "ws", - }), net.DomainAddress("localhost"), 13146, func(ctx context.Context, conn internet.Connection) bool { + }), net.DomainAddress("localhost"), 13146, func(conn internet.Connection) { go func(c internet.Connection) { defer c.Close() @@ -33,7 +33,6 @@ func Test_listenWSAndDial(t *testing.T) { _, err = c.Write([]byte("Response")) assert(err, IsNil) }(conn) - return true }) assert(err, IsNil) @@ -67,7 +66,7 @@ func TestDialWithRemoteAddr(t *testing.T) { assert := With(t) listen, err := ListenWS(internet.ContextWithTransportSettings(context.Background(), &Config{ Path: "ws", - }), net.DomainAddress("localhost"), 13148, func(ctx context.Context, conn internet.Connection) bool { + }), net.DomainAddress("localhost"), 13148, func(conn internet.Connection) { go func(c internet.Connection) { defer c.Close() @@ -84,7 +83,6 @@ func TestDialWithRemoteAddr(t *testing.T) { _, err = c.Write([]byte("Response")) assert(err, IsNil) }(conn) - return true }) assert(err, IsNil) @@ -115,11 +113,10 @@ func Test_listenWSAndDial_TLS(t *testing.T) { AllowInsecure: true, Certificate: []*v2tls.Certificate{tlsgen.GenerateCertificateForTest()}, }) - listen, err := ListenWS(ctx, net.DomainAddress("localhost"), 13143, func(ctx context.Context, conn internet.Connection) bool { + listen, err := ListenWS(ctx, net.DomainAddress("localhost"), 13143, func(conn internet.Connection) { go func() { _ = conn.Close() }() - return true }) assert(err, IsNil) defer listen.Close()