use of org.apache.dubbo.rpc.protocol.dubbo.DubboCodec in project dubbo by alibaba.
the class DubboTelnetDecodeTest method createDubboByteBuf.
private ByteBuf createDubboByteBuf() throws IOException {
Request request = new Request();
RpcInvocation rpcInvocation = new RpcInvocation();
rpcInvocation.setMethodName("sayHello");
rpcInvocation.setParameterTypes(new Class[] { String.class });
rpcInvocation.setParameterTypesDesc(ReflectUtils.getDesc(new Class[] { String.class }));
rpcInvocation.setArguments(new String[] { "dubbo" });
rpcInvocation.setAttachment("path", DemoService.class.getName());
rpcInvocation.setAttachment("interface", DemoService.class.getName());
rpcInvocation.setAttachment("version", "0.0.0");
request.setData(rpcInvocation);
request.setVersion("2.0.2");
ByteBuf dubboByteBuf = Unpooled.buffer();
ChannelBuffer buffer = new NettyBackedChannelBuffer(dubboByteBuf);
DubboCodec dubboCodec = new DubboCodec();
dubboCodec.encode(new MockChannel(), buffer, request);
return dubboByteBuf;
}
Aggregations