public override void write(ConnectionHandlerContext ctx, object msg)
        {
            if (msg is ByteBuf)
            {
                tempBuf.Clear();
                ByteBuf buf = (ByteBuf)msg;
                if (LengthBytes == 2)
                {
                    ushort len = (ushort)buf.remainBytes();
                    tempBuf.writeUInt16(len);
                }
                else if (LengthBytes == 4)
                {
                    uint len = (uint)buf.remainBytes();
                    tempBuf.writeUInt32(len);
                }
                else if (LengthBytes == 8)
                {
                    ulong len = (ulong)buf.remainBytes();
                    tempBuf.writeUInt64(len);
                }
                tempBuf.writeBytes(buf);

                ctx.fireWrite(tempBuf);
            }
        }
        public override void  write(ConnectionHandlerContext ctx, object msg)
        {
            tempBuf.MakeBufferEmpty();
            memStream.Position = 0;
            ProtoBuf.Serializer.Serialize(memStream, msg);
            int writeIndex = (int)memStream.Position;

            tempBuf.setWriteIndex(writeIndex);

            ctx.fireWrite(tempBuf);
        }
 public void write(Object msg)
 {
     tail.fireWrite(msg);
 }