diff --git a/lib/jsonrpc/rpc_test.go b/lib/jsonrpc/rpc_test.go index 307050061..3366f6fa3 100644 --- a/lib/jsonrpc/rpc_test.go +++ b/lib/jsonrpc/rpc_test.go @@ -62,7 +62,6 @@ func TestRPC(t *testing.T) { // httptest stuff testServ := httptest.NewServer(rpcServer) defer testServ.Close() - // setup client var client struct { @@ -70,7 +69,7 @@ func TestRPC(t *testing.T) { AddGet func(int) int StringMatch func(t TestType, i2 int64) (out TestOut, err error) } - closer, err := NewClient(testServ.URL, "SimpleServerHandler", &client) + closer, err := NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &client) if err != nil { t.Fatal(err) } @@ -133,7 +132,7 @@ func TestRPC(t *testing.T) { var noret struct { Add func(int) } - closer, err = NewClient(testServ.URL, "SimpleServerHandler", &noret) + closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &noret) if err != nil { t.Fatal(err) } @@ -148,7 +147,7 @@ func TestRPC(t *testing.T) { var noparam struct { Add func() } - closer, err = NewClient(testServ.URL, "SimpleServerHandler", &noparam) + closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &noparam) if err != nil { t.Fatal(err) } @@ -160,7 +159,7 @@ func TestRPC(t *testing.T) { var erronly struct { AddGet func() (int, error) } - closer, err = NewClient(testServ.URL, "SimpleServerHandler", &erronly) + closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &erronly) if err != nil { t.Fatal(err) } @@ -174,7 +173,7 @@ func TestRPC(t *testing.T) { var wrongtype struct { Add func(string) error } - closer, err = NewClient(testServ.URL, "SimpleServerHandler", &wrongtype) + closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &wrongtype) if err != nil { t.Fatal(err) } @@ -188,7 +187,7 @@ func TestRPC(t *testing.T) { var notfound struct { NotThere func(string) error } - closer, err = NewClient(testServ.URL, "SimpleServerHandler", ¬found) + closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", ¬found) if err != nil { t.Fatal(err) } @@ -237,7 +236,7 @@ func TestCtx(t *testing.T) { var client struct { Test func(ctx context.Context) } - closer, err := NewClient(testServ.URL, "CtxHandler", &client) + closer, err := NewClient("ws://" + testServ.Listener.Addr().String(), "CtxHandler", &client) if err != nil { t.Fatal(err) } @@ -260,7 +259,7 @@ func TestCtx(t *testing.T) { var noCtxClient struct { Test func() } - closer, err = NewClient(testServ.URL, "CtxHandler", &noCtxClient) + closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "CtxHandler", &noCtxClient) if err != nil { t.Fatal(err) }