@Test public void testHeaderEncode() throws Exception { int messageID = 0xAABB; PubAckEncoder encoder = new PubAckEncoder(); PubAckMessage msg = new PubAckMessage(); msg.setMessageID(messageID); ByteBuf out = Unpooled.buffer(); encoder.encode(m_mockedContext, msg, out); assertEquals(0x40, out.readByte()); assertEquals(0x02, out.readByte()); assertEquals((byte)0xAA, out.readByte()); assertEquals((byte)0xBB, out.readByte()); }
@Override protected void encode(ChannelHandlerContext chc, PubAckMessage msg, ByteBuf out) { ByteBuf buff = chc.alloc().buffer(4); buff.writeByte(AbstractMessage.PUBACK << 4); buff.writeBytes(Utils.encodeRemainingLength(2)); buff.writeShort(msg.getMessageID()); out.writeBytes(buff); }
PubAckEncoder extends DemuxEncoder<PubAckMessage> { @Override protected void encode(ChannelHandlerContext chc, PubAckMessage msg, ByteBuf out) { ByteBuf buff = chc.alloc().buffer(4); buff.writeByte(AbstractMessage.PUBACK << 4); buff.writeBytes(Utils.encodeRemainingLength(2)); buff.writeShort(msg.getMessageID()); out.writeBytes(buff); } }
PubAckEncoder extends DemuxEncoder<PubAckMessage> { @Override protected void encode(ChannelHandlerContext chc, PubAckMessage msg, ByteBuf out) { ByteBuf buff = chc.alloc().buffer(4); buff.writeByte(AbstractMessage.PUBACK << 4); buff.writeBytes(Utils.encodeRemainingLength(2)); buff.writeShort(msg.getMessageID()); out.writeBytes(buff); }  }
PubAckEncoder extends DemuxEncoder<PubAckMessage> { @Override protected void encode(ChannelHandlerContext chc, PubAckMessage msg, ByteBuf out) { ByteBuf buff = chc.alloc().buffer(4); buff.writeByte(AbstractMessage.PUBACK << 4); buff.writeBytes(Utils.encodeRemainingLength(2)); buff.writeShort(msg.getMessageID()); out.writeBytes(buff); }   }
PubAckEncoder extends DemuxEncoder<PubAckMessage> { @Override protected void encode(ChannelHandlerContext chc, PubAckMessage msg, ByteBuf out) { ByteBuf buff = chc.alloc().buffer(4); buff.writeByte(AbstractMessage.PUBACK << 4); buff.writeBytes(Utils.encodeRemainingLength(2)); buff.writeShort(msg.getMessageID()); out.writeBytes(buff); }    }