// Server read message then close, so `Send` will return retry error. func (s *testClientSuite) TestRetryReadThenClose(c *C) { l := startServer(":61236", c, readThenCloseRequest) defer l.Close() cli := newRPCClient() req := new(pb.Request) req.Type = pb.MessageType_CmdGet resp, err := cli.SendKVReq(":61236", req, readTimeoutShort) c.Assert(err, NotNil) c.Assert(resp, IsNil) }
// One normally `Send`. func (s *testClientSuite) TestSendBySelf(c *C) { l := startServer(":61234", c, handleRequest) defer l.Close() cli := newRPCClient() req := new(pb.Request) req.Type = pb.MessageType_CmdGet getReq := new(pb.CmdGetRequest) getReq.Key = []byte("a") ver := uint64(0) getReq.Version = ver req.CmdGetReq = getReq resp, err := cli.SendKVReq(":61234", req, readTimeoutShort) c.Assert(err, IsNil) c.Assert(req.GetType(), Equals, resp.GetType()) }