// TestGoRPCGoClient tests the go client using goRPC func TestGoRPCGoClient(t *testing.T) { service := services.CreateServices() // listen on a random port listener, err := net.Listen("tcp", ":0") if err != nil { t.Fatalf("Cannot listen: %v", err) } defer listener.Close() // Create a Go Rpc server and listen on the port server := rpcplus.NewServer() server.Register(bsonp3vtgateservice.New(service)) // create the HTTP server, serve the server from it handler := http.NewServeMux() bsonrpc.ServeCustomRPC(handler, server, false) httpServer := http.Server{ Handler: handler, } go httpServer.Serve(listener) // and run the test suite goclienttest.TestGoClient(t, "bsonp3", listener.Addr().String()) }
// TestGRPCGoClient tests the go client using gRPC func TestGRPCGoClient(t *testing.T) { service := services.CreateServices() // listen on a random port listener, err := net.Listen("tcp", ":0") if err != nil { t.Fatalf("Cannot listen: %v", err) } defer listener.Close() // Create a gRPC server and listen on the port server := grpc.NewServer() grpcvtgateservice.RegisterForTest(server, service) go server.Serve(listener) // and run the test suite goclienttest.TestGoClient(t, "grpc", listener.Addr().String()) }