@Test
    public void testInvokeContextCustomSerializer_FUTURE() throws Exception {
        NormalRequestBodyCustomSerializer_InvokeContext s1 = new NormalRequestBodyCustomSerializer_InvokeContext();
        NormalStringCustomSerializer_InvokeContext s2 = new NormalStringCustomSerializer_InvokeContext();
        CustomSerializerManager.registerCustomSerializer(RequestBody.class.getName(), s1);
        CustomSerializerManager.registerCustomSerializer(String.class.getName(), s2);

        RequestBody body = new RequestBody(1, "hello world!");
        InvokeContext invokeContext = new InvokeContext();
        invokeContext.putIfAbsent(NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE_KEY,
            NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE1_value);
        RpcResponseFuture future = client.invokeWithFuture(addr, body, invokeContext, 1000);
        String ret = (String) future.get(1000);
        Assert.assertEquals(RequestBody.DEFAULT_SERVER_RETURN_STR + "RANDOM", ret);
        Assert.assertTrue(s1.isSerialized());
        Assert.assertTrue(s1.isDeserialized());

        invokeContext.clear();
        invokeContext.putIfAbsent(NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE_KEY,
            NormalRequestBodyCustomSerializer_InvokeContext.SERIALTYPE2_value);
        future = client.invokeWithFuture(addr, body, invokeContext, 1000);
        ret = (String) future.get(1000);
        Assert.assertEquals(NormalStringCustomSerializer_InvokeContext.UNIVERSAL_RESP, ret);
        Assert.assertTrue(s1.isSerialized());
        Assert.assertTrue(s1.isDeserialized());
    }
test custom serializer using invoke contxt in future
@throws Exception
src/test/java/com/alipay/remoting/rpc/serializer/ClassCustomSerializerTest.java