Search in sources :

Example 1 with Codec

use of com.weibo.api.motan.codec.Codec in project motan by weibocom.

the class CompressRpcCodecTest method testCompatibility.

// 测试server端对旧版本的兼容性
@Test
public void testCompatibility() throws IOException {
    DefaultRequest request = getRequest("int[]", new Object[] { new int[] { 1, 2 } });
    Codec v1Codec = new DefaultRpcCodec();
    byte[] bytes = v1Codec.encode(channel, request);
    assertTrue(isV1Version(bytes));
    Request result = (Request) rpcCodec.decode(channel, "", bytes);
    Assert.assertTrue(equals(request, result));
}
Also used : Codec(com.weibo.api.motan.codec.Codec) DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Request(com.weibo.api.motan.rpc.Request) DefaultRequest(com.weibo.api.motan.rpc.DefaultRequest) Test(org.junit.Test)

Aggregations

Codec (com.weibo.api.motan.codec.Codec)1 DefaultRequest (com.weibo.api.motan.rpc.DefaultRequest)1 Request (com.weibo.api.motan.rpc.Request)1 Test (org.junit.Test)1