Exemplo n.º 1
0
func TestAll(t *testing.T) {
	conn, err := net.Dial("tcp", "127.0.0.1:1984")
	if err != nil {
		t.Fatalf(`net.Dial("tcp", "127.0.0.1:1984"): %v`, err)
	}
	client := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
	defer client.Close()

	testArithClient(t, client)
	testEchoClient(t, client)

	arithStub := &ArithServiceClient{client}
	echoStub := &EchoServiceClient{client}

	testArithStub(t, arithStub)
	testEchoStub(t, echoStub)
}
Exemplo n.º 2
0
func TestInternalMessagePkg(t *testing.T) {
	err := listenAndServeArithAndEchoService("tcp", "127.0.0.1:1414")
	if err != nil {
		log.Fatalf("listenAndServeArithAndEchoService: %v", err)
	}

	conn, err := net.Dial("tcp", "127.0.0.1:1414")
	if err != nil {
		t.Fatalf(`net.Dial("tcp", "127.0.0.1:1414"): %v`, err)
	}
	client := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
	defer client.Close()

	testArithClient(t, client)
	testEchoClient(t, client)

	testArithClientAsync(t, client)
	testEchoClientAsync(t, client)
}
Exemplo n.º 3
0
// NewSuperServiceClient returns a SuperService stub to handle
// requests to the set of SuperService at the other end of the connection.
func NewSuperServiceClient(conn io.ReadWriteCloser) *SuperServiceClient {
	c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
	return &SuperServiceClient{c}
}
Exemplo n.º 4
0
// NewEchoServiceClient returns a EchoService stub to handle
// requests to the set of EchoService at the other end of the connection.
func NewEchoServiceClient(conn io.ReadWriteCloser) *EchoServiceClient {
	c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
	return &EchoServiceClient{c}
}