RpcEncoder encoder = new RpcEncoder();
EchoRequest request = EchoRequest.newBuilder().setPayload("Hello").build();
RpcMessage message = RpcMessage.newBuilder().setType(MessageType.REQUEST).setId(1)
.setService(EchoService.getDescriptor().getName())
.setMethod(EchoService.getDescriptor().getMethods().get(0).getName())
.setRequest(request.toByteString()).build();
encoder.encode(null, null, message);
}
@Test
public void testDecoder() throws Exception {