@Test
    public void testSync() throws InterruptedException {
        RequestBody req = new RequestBody(1, "hello world sync");
        for (int i = 0; i < invokeTimes; i++) {
            try {
                String res = null;
                if (i % 2 == 0) {
                    res = (String) client.invokeSync(addr, req, 3000);
                } else {
                    InvokeContext invokeContext = new InvokeContext();
                    invokeContext.putIfAbsent(InvokeContext.BOLT_CRC_SWITCH, false);
                    res = (String) client.invokeSync(addr, req, invokeContext, 3000);
                }
                logger.warn("Result received in sync: " + res);
                Assert.assertEquals(RequestBody.DEFAULT_SERVER_RETURN_STR, res);
            } catch (RemotingException e) {
                String errMsg = "RemotingException caught in sync!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            } catch (InterruptedException e) {
                String errMsg = "InterruptedException caught in sync!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            }
        }

        Assert.assertTrue(serverConnectProcessor.isConnected());
        Assert.assertEquals(1, serverConnectProcessor.getConnectTimes());
        Assert.assertEquals(invokeTimes, serverUserProcessor.getInvokeTimes());
    }
basic usage test for protocol v2.2

basic usage of rpc client and rpc server

@author xiaomin.cxm
@version $Id: BasicUsage_ProtocolV2_2_Test.java, v 0.1 Oct 10, 2017 12:58:36 PM xiaomin.cxm Exp $
src/test/java/com/alipay/remoting/rpc/BasicUsage_ProtocolV1_Test.java