@Test public void testHeaderEncode() throws Exception { ConnAckMessage msg = new ConnAckMessage(); ByteBuf out = Unpooled.buffer(); m_encoder.encode(m_mockedContext, msg, out); assertEquals(0x20, out.readByte()); assertEquals(0x02, out.readByte()); assertEquals(ConnAckMessage.CONNECTION_ACCEPTED, out.skipBytes(1).readByte()); }
@Override protected void encode(ChannelHandlerContext chc, ConnAckMessage message, ByteBuf out) { out.writeByte(AbstractMessage.CONNACK << 4); out.writeBytes(Utils.encodeRemainingLength(2)); out.writeByte(0); out.writeByte(message.getReturnCode()); }
ConnAckEncoder extends DemuxEncoder<ConnAckMessage> { @Override protected void encode(ChannelHandlerContext chc, ConnAckMessage message, ByteBuf out) { out.writeByte(AbstractMessage.CONNACK << 4); out.writeBytes(Utils.encodeRemainingLength(2)); out.writeByte(0); out.writeByte(message.getReturnCode()); } }
ConnAckEncoder extends DemuxEncoder<ConnAckMessage> { @Override protected void encode(ChannelHandlerContext chc, ConnAckMessage message, ByteBuf out) { out.writeByte(AbstractMessage.CONNACK << 4); out.writeBytes(Utils.encodeRemainingLength(2)); out.writeByte(0); out.writeByte(message.getReturnCode()); }  }
ConnAckEncoder extends DemuxEncoder<ConnAckMessage> { @Override protected void encode(ChannelHandlerContext chc, ConnAckMessage message, ByteBuf out) { out.writeByte(AbstractMessage.CONNACK << 4); out.writeBytes(Utils.encodeRemainingLength(2)); out.writeByte(0); out.writeByte(message.getReturnCode()); }   }
ConnAckEncoder extends DemuxEncoder<ConnAckMessage> { @Override protected void encode(ChannelHandlerContext chc, ConnAckMessage message, ByteBuf out) { out.writeByte(AbstractMessage.CONNACK << 4); out.writeBytes(Utils.encodeRemainingLength(2)); out.writeByte(0); out.writeByte(message.getReturnCode()); }    }