@Test public void testHeader() throws Exception { m_buff = IoBuffer.allocate(14); initHeader(m_buff); m_buff.flip(); MessageDecoderResult res = m_msgdec.decode(null, m_buff, m_mockProtoDecoder); assertNotNull(m_mockProtoDecoder.getMessage()); assertEquals(MessageDecoder.OK, res); assertEquals(ConnAckMessage.CONNECTION_ACCEPTED, m_mockProtoDecoder.getMessage().getReturnCode()); assertEquals(AbstractMessage.CONNACK, m_mockProtoDecoder.getMessage().getMessageType()); }
public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { ConnAckMessage message = new ConnAckMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } in.skip(1); message.setReturnCode(in.get()); out.write(message); return OK; }
ConnAckDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { ConnAckMessage message = new ConnAckMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } in.skip(1); message.setReturnCode(in.get()); out.write(message); return OK; } }
ConnAckDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { ConnAckMessage message = new ConnAckMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } in.skip(1); message.setReturnCode(in.get()); out.write(message); return OK; }  }
ConnAckDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { ConnAckMessage message = new ConnAckMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } in.skip(1); message.setReturnCode(in.get()); out.write(message); return OK; }  MessageDecoderResult decodable(IoSession session, IoBuffer in); MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out); }
ConnAckDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { ConnAckMessage message = new ConnAckMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } in.skip(1); message.setReturnCode(in.get()); out.write(message); return OK; }  MessageDecoderResult decodable(IoSession session, IoBuffer in); MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out);  }