@Test public void testHeader() throws Exception { m_buff = Unpooled.buffer(14); initHeader(m_buff); List<Object> results = new ArrayList<Object >(); m_msgdec.decode(null, m_buff, results); assertFalse(results.isEmpty()); ConnAckMessage message = (ConnAckMessage)results.get(0); assertNotNull(message); assertEquals(ConnAckMessage.CONNECTION_ACCEPTED, message.getReturnCode()); assertEquals(AbstractMessage.CONNACK, message.getMessageType()); }
@Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { in.resetReaderIndex(); ConnAckMessage message = new ConnAckMessage(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } in.skipBytes(1); message.setReturnCode(in.readByte()); out.add(message); }
ConnAckDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { in.resetReaderIndex(); ConnAckMessage message = new ConnAckMessage(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } in.skipBytes(1); message.setReturnCode(in.readByte()); out.add(message); } }
ConnAckDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { in.resetReaderIndex(); ConnAckMessage message = new ConnAckMessage(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } in.skipBytes(1); message.setReturnCode(in.readByte()); out.add(message); }  }
ConnAckDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { in.resetReaderIndex(); ConnAckMessage message = new ConnAckMessage(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } in.skipBytes(1); message.setReturnCode(in.readByte()); out.add(message); }   }
ConnAckDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { in.resetReaderIndex(); ConnAckMessage message = new ConnAckMessage(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } in.skipBytes(1); message.setReturnCode(in.readByte()); out.add(message); }    }