public void encode(ChannelHandlerContext ctx, Frame frame, List results)
throws IOException
{
ByteBuf header = Unpooled.buffer(Frame.Header.LENGTH);
Message.Type type = frame.header.type;
header.writeByte(type.direction.addToVersion(frame.header.version));
header.writeByte(Header.Flag.serialize(frame.header.flags));
header.writeByte(frame.header.streamId);
header.writeByte(type.opcode);
header.writeInt(frame.body.readableBytes());