   dubbo-rpc/dubbo-rpc-rmi
   dubbo-rpc/dubbo-rpc-thrift
   dubbo-rpc/dubbo-rpc-webservice/
try {
            bos.setWriteIndex(ThriftCodec.MESSAGE_HEADER_LENGTH_INDEX);
            protocol.writeI16((short) (0xffff & headerLength));
            bos.setWriteIndex(ThriftCodec.MESSAGE_LENGTH_INDEX);
            protocol.writeI32(messageLength);
        } finally {
            bos.setWriteIndex(oldIndex);
        }
        Object obj = codec.decode((Channel) null, ChannelBuffers.wrappedBuffer(
                encodeFrame(bos.toByteArray())));
        Assert.assertTrue(obj instanceof Request);
        obj = ((Request) obj).getData();
        Assert.assertTrue(obj instanceof RpcInvocation);
        RpcInvocation invocation = (RpcInvocation) obj;
        Assert.assertEquals("echoString", invocation.getMethodName());
        Assert.assertArrayEquals(new Class[]{String.class}, invocation.getParameterTypes());
        Assert.assertArrayEquals(new Object[]{args.getArg()}, invocation.getArguments());
    }
    private Request createRequest() {
        RpcInvocation invocation = new RpcInvocation();
        invocation.setMethodName("echoString");
        invocation.setArguments(new Object[]{"Hello, World!"});
        invocation.setParameterTypes(new Class<?>[]{String.class});
        invocation.setAttachment(Constants.INTERFACE_KEY, Demo.Iface.class.getName());
        Request request = new Request(1L);
        request.setData(invocation);
        return request;
    }
}