   dubbo-rpc/dubbo-rpc-rmi
   dubbo-rpc/dubbo-rpc-thrift
   dubbo-rpc/dubbo-rpc-webservice/
ChannelBuffer bis = ChannelBuffers.wrappedBuffer(encodeFrame(bos.toByteArray()));
        Object obj = codec.decode((Channel) null, bis);
        Assert.assertNotNull(obj);
        Assert.assertTrue(obj instanceof Response);
        Response response = (Response) obj;
        Assert.assertTrue(response.getResult() instanceof RpcResult);
        RpcResult result = (RpcResult) response.getResult();
        Assert.assertTrue(result.hasException());
        Assert.assertTrue(result.getException() instanceof RpcException);
    }
    @Test
    public void testEncodeReplyResponse() throws Exception {
        URL url = URL.valueOf(ThriftProtocol.NAME + "://127.0.0.1:40880/" + Demo.Iface.class.getName());
        Channel channel = new MockedChannel(url);
        Request request = createRequest();
        RpcResult rpcResult = new RpcResult();
        rpcResult.setResult("Hello, World!");
        Response response = new Response();
        response.setResult(rpcResult);
        response.setId(request.getId());
        ChannelBuffer bos = ChannelBuffers.dynamicBuffer(1024);
        ThriftCodec.RequestData rd = ThriftCodec.RequestData.create(
                ThriftCodec.getSeqId(), Demo.Iface.class.getName(), "echoString");
        ThriftCodec.cachedRequest.putIfAbsent(request.getId(), rd);
        codec.encode(channel, bos, response);
        byte[] buf = new byte[bos.writerIndex() - 4];
        System.arraycopy(bos.array(), 4, buf, 0, bos.writerIndex() - 4);
        ByteArrayInputStream bis = new ByteArrayInputStream(buf);
        if (bis.markSupported()) {
            bis.mark(0);