@Test
    public void testCallback() throws InterruptedException {
        RequestBody b3 = new RequestBody(3, "hello world callback");
        final List<String> rets = new ArrayList<String>(1);
        for (int i = 0; i < 3; i++) {
            final CountDownLatch latch = new CountDownLatch(1);
            try {
                System.setProperty(Configs.SERIALIZER, String.valueOf(i));
                client.invokeWithCallback(addr, b3, new InvokeCallback() {

                    @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);
                    }

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

                }, 1000);

            } catch (CodecException e) {
                String errMsg = "Codec Exception caught in callback!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            } catch (RemotingException e) {
                String errMsg = "Remoting Exception caught in callback!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            } catch (InterruptedException e) {
                String errMsg = "Interrupted Exception caught in callback!";
                logger.error(errMsg, e);
                Assert.fail(errMsg);
            }
            latch.await();
            Assert.assertEquals(RequestBody.DEFAULT_SERVER_RETURN_STR, rets.get(0));
            rets.clear();
        }
    }
Codec Test

Test three type serializer [HESSIAN, JAVA, JSON]

note: json need the class have a default constructor

@author jiangping
@version $Id: CodecTest.java, v 0.1 2015-9-7 PM5:00:26 tao Exp $
src/test/java/com/alipay/remoting/rpc/serializer/CodecTest.java