@Test
    public void testFuture() throws InterruptedException, RemotingException {
        client.getConnection(addr, 1000);

        RequestBody req = new RequestBody(1, RequestBody.DEFAULT_SERVER_STR);
        for (int i = 0; i < invokeTimes; i++) {
            try {
                // only when client invoked, the remote address can be get by UserProcessor
                // otherwise, please use ConnectionEventProcessor
                String remoteAddr = serverUserProcessor.getRemoteAddr();
                Assert.assertNull(remoteAddr);
                remoteAddr = serverConnectProcessor.getRemoteAddr();
                Assert.assertNotNull(remoteAddr);
                RpcResponseFuture future = server.getRpcServer().invokeWithFuture(remoteAddr, req,
                    1000);
                String clientres = (String) future.get(1000);
                Assert.assertEquals(clientres, RequestBody.DEFAULT_CLIENT_RETURN_STR);
            } catch (RemotingException e) {
                String errMsg = "RemotingException caught in future!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            }
        }

        Assert.assertTrue(serverConnectProcessor.isConnected());
        Assert.assertEquals(1, serverConnectProcessor.getConnectTimes());
        Assert.assertEquals(0, serverUserProcessor.getInvokeTimes());
        Assert.assertEquals(invokeTimes, clientUserProcessor.getInvokeTimes());
    }
Basic usage test of Rpc Server invoke apis

@author xiaomin.cxm
@version $Id: ServerBasicUsageTest.java, v 0.1 Apr 14, 2016 10:00:48 AM xiaomin.cxm Exp $
src/test/java/com/alipay/remoting/rpc/ServerBasicUsageTest.java