ChannelBuffer buffer = new BigEndianHeapChannelBuffer(4 + size + 4);
buffer.writeBytes("RPC0".getBytes());
int writerIndex = buffer.writerIndex();
CodedOutputStream output = CodedOutputStream.newInstance(
buffer.array(), buffer.writerIndex(), buffer.writableBytes() - 4);
message.writeTo(output);
output.checkNoSpaceLeft();
buffer.writerIndex(writerIndex + size);
Adler32 checksum = new Adler32();
checksum.update(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());