@Test
    public void callback() throws InterruptedException {
        RequestBody b3 = new RequestBody(3, "Hello world!");
        final CountDownLatch latch = new CountDownLatch(1);
        final List<Throwable> ret = new ArrayList<Throwable>(1);
        try {
            client.invokeWithCallback(addr, b3, new InvokeCallback() {

                @Override
                public void onResponse(Object result) {
                    Assert.fail("Should not reach here!");
                }

                @Override
                public void onException(Throwable e) {
                    ret.add(e);
                    latch.countDown();
                }

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

            }, 1000);

        } catch (RemotingException e) {
            logger.error(
                "Other RemotingException but InvokeServerBusyException occurred in callback", e);
            Assert.fail("Should not reach here!");
        }
        latch.await();
        Assert.assertEquals(InvokeServerBusyException.class, ret.get(0).getClass());
    }
@author jiangping
@version $Id: ServerBusyTest.java, v 0.1 2015-10-20 PM2:48:57 tao Exp $
src/test/java/com/alipay/remoting/rpc/exception/ServerBusyTest.java