Example #1
0
func testEchoClient(t *testing.T, client *rpc.Client) {
	var args message.EchoRequest
	var reply message.EchoResponse
	var err error

	// EchoService.Echo
	args.Msg = "Hello, Protobuf-RPC"
	if err = client.Call("EchoService.Echo", &args, &reply); err != nil {
		t.Fatalf(`EchoService.Echo: %v`, err)
	}
	if reply.GetMsg() != args.GetMsg() {
		t.Fatalf(`EchoService.Echo: expected = "%s", got = "%s"`, args.GetMsg(), reply.GetMsg())
	}
}
Example #2
0
func (t *Echo) Echo(args *message.EchoRequest, reply *message.EchoResponse) error {
	reply.Msg = args.Msg
	return nil
}