@@ -0,0 +1,2059 @@
+package org.projectodd.restafari.container.stomp;%0A%0Aimport io.netty.buffer.ByteBuf;%0Aimport io.netty.buffer.Unpooled;%0Aimport io.netty.channel.ChannelHandlerContext;%0Aimport io.netty.handler.codec.MessageToByteEncoder;%0A%0Aimport java.util.Set;%0A%0A/**%0A * @author Bob McWhirter%0A */%0Apublic class StompFrameEncoder extends MessageToByteEncoder%3CStompFrame%3E %7B%0A%0A    private static final int HEADER_ESTIMATE = 1024;%0A    private static final byte%5B%5D HEADER_DELIM = %22:%22.getBytes();%0A    private static final byte NEWLINE = (byte) '%5Cn';%0A    private static final byte NULL = (byte) 0x00;%0A%0A%0A    @Override%0A    protected void encode(ChannelHandlerContext ctx, StompFrame frame, ByteBuf out) throws Exception %7B%0A        writeHeader( frame, out );%0A        writeContent( frame, out );%0A    %7D%0A%0A    protected void writeHeader(StompFrame frame, ByteBuf buffer) %7B%0A        buffer.writeBytes( frame.getCommand().getBytes() );%0A        buffer.writeByte( NEWLINE );%0A        Set%3CString%3E headerNames = frame.getHeaderNames();%0A        for (String name : headerNames) %7B%0A            if (name.equalsIgnoreCase( %22content-length%22 )) %7B%0A                continue;%0A            %7D%0A            buffer.writeBytes( name.getBytes() );%0A            buffer.writeBytes( HEADER_DELIM );%0A            buffer.writeBytes( frame.getHeader( name ).getBytes() );%0A            buffer.writeByte( NEWLINE );%0A        %7D%0A%0A        if (frame instanceof StompContentFrame) %7B%0A            int length = ((StompContentFrame) frame).getContent().readableBytes();%0A            buffer.writeBytes( StompFrame.Header.CONTENT_LENGTH.getBytes() );%0A            buffer.writeBytes( HEADER_DELIM );%0A            buffer.writeBytes( (%22%22 + length).getBytes() );%0A            buffer.writeByte( NEWLINE );%0A        %7D%0A%0A        buffer.writeByte( NEWLINE );%0A    %7D%0A%0A    protected void writeContent(StompFrame frame, ByteBuf buffer) %7B%0A        if (frame instanceof StompContentFrame) %7B%0A            ByteBuf content = ((StompContentFrame) frame).getContent();%0A            buffer.writeBytes( content );%0A        %7D%0A        buffer.writeByte( NULL );%0A        return;%0A    %7D%0A%7D%0A

Add encoder.