@Test public void testHeaderEncode() throws Exception { int messageID = 0xAABB; TestUtils.MockProtocolEncoderOutput mockProtoEncoder = new TestUtils.MockProtocolEncoderOutput(); PubAckEncoder encoder = new PubAckEncoder(); PubAckMessage msg = new PubAckMessage(); msg.setMessageID(messageID); encoder.encode(null, msg, mockProtoEncoder); assertEquals(0x40, mockProtoEncoder.getBuffer().get()); assertEquals(0x02, mockProtoEncoder.getBuffer().get()); assertEquals((byte)0xAA, mockProtoEncoder.getBuffer().get()); assertEquals((byte)0xBB, mockProtoEncoder.getBuffer().get()); }
public void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.PUBACK << 4)); buff.put(Utils.encodeRemainingLength(2)); Utils.writeWord(buff, message.getMessageID()); buff.flip(); out.write(buff); }
PubAckEncoder implements MessageEncoder<PubAckMessage> { public void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.PUBACK << 4)); buff.put(Utils.encodeRemainingLength(2)); Utils.writeWord(buff, message.getMessageID()); buff.flip(); out.write(buff); } }
PubAckEncoder implements MessageEncoder<PubAckMessage> { public void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.PUBACK << 4)); buff.put(Utils.encodeRemainingLength(2)); Utils.writeWord(buff, message.getMessageID()); buff.flip(); out.write(buff); }  }
PubAckEncoder implements MessageEncoder<PubAckMessage> { public void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.PUBACK << 4)); buff.put(Utils.encodeRemainingLength(2)); Utils.writeWord(buff, message.getMessageID()); buff.flip(); out.write(buff); }  void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out); }
PubAckEncoder implements MessageEncoder<PubAckMessage> { public void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.PUBACK << 4)); buff.put(Utils.encodeRemainingLength(2)); Utils.writeWord(buff, message.getMessageID()); buff.flip(); out.write(buff); }  void encode(IoSession session, PubAckMessage message, ProtocolEncoderOutput out);  }