RpcEncoder encoder = new RpcEncoder();
SudokuRequest request = SudokuRequest.newBuilder().setCheckerboard("001010").build();
RpcMessage message = RpcMessage.newBuilder().setType(MessageType.REQUEST).setId(1)
.setService(SudokuService.getDescriptor().getFullName())
.setMethod(SudokuService.getDescriptor().getMethods().get(0).getName())
.setRequest(request.toByteString()).build();
ChannelBuffer buffer = (ChannelBuffer) encoder.encode(null, null, message);
RpcDecoder decoder = new RpcDecoder();
RpcMessage decodedMessage = (RpcMessage) decoder.decode(null, null, buffer);
assertEquals(1, decodedMessage.getId());