Example #1
0
func testSendDeadlock(client *protorpc.Client) {
	defer func() {
		recover()
	}()
	args := &Args{7, 8}
	reply := new(Reply)
	client.Call("Arith.Add", args, reply)
}
Example #2
0
func testHTTPRPC(t *testing.T, path string) {
	var client *protorpc.Client
	var err error
	if path == "" {
		client, err = protorpc.DialHTTP("tcp", httpServerAddr)
	} else {
		client, err = protorpc.DialHTTPPath("tcp", httpServerAddr, path)
	}
	if err != nil {
		t.Fatal("dialing", err)
	}
	defer client.Close()

	// Synchronous calls
	args := &Args{7, 8}
	reply := new(Reply)
	err = client.Call("Arith.Add", args, reply)
	if err != nil {
		t.Errorf("Add: expected no error but got string %q", err.Error())
	}
	if reply.C != args.A+args.B {
		t.Errorf("Add: expected %d got %d", reply.C, args.A+args.B)
	}
}