private Object doInvoke(RequestBody.InvokeType type, String url) throws RemotingException,
                                                                    InterruptedException {
        RequestBody b1 = new RequestBody(1, "hello world");
        Object obj = null;
        if (type.equals(RequestBody.InvokeType.ONEWAY)) {
            client.oneway(url, b1);
        } else if (type.equals(RequestBody.InvokeType.SYNC)) {
            obj = client.invokeSync(url, b1, 3000);
        } else if (type.equals(RequestBody.InvokeType.FUTURE)) {
            RpcResponseFuture future = client.invokeWithFuture(url, b1, 3000);
            obj = future.get(3000);
        } else if (type.equals(RequestBody.InvokeType.CALLBACK)) {
            final List<String> rets = new ArrayList<String>(1);
            final CountDownLatch latch = new CountDownLatch(1);
            client.invokeWithCallback(url, b1, new InvokeCallback() {
                Executor executor = Executors.newCachedThreadPool();

                @Override
                public void onResponse(Object result) {
                    logger.warn("Result received in callback: " + result);
                    rets.add((String) result);
                    latch.countDown();
                }

                @Override
                public void onException(Throwable e) {
                    logger.error("Process exception in callback.", e);
                    latch.countDown();
                }

                @Override
                public Executor getExecutor() {
                    return executor;
                }

            }, 3000);
            try {
                latch.await();
            } catch (InterruptedException e) {
                String errMsg = "InterruptedException caught in callback!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            }
            if (rets.size() == 0) {
                Assert.fail("No result of callback! Maybe exception caught!");
            }
            obj = rets.get(0);
        }
        return obj;

    }
do invoke

@param type
@param url
@return
@throws RemotingException
@throws InterruptedException
src/test/java/com/alipay/remoting/rpc/addressargs/AddressArgs_CONNECTIONNUM_Test.java