@Test public void testBadQos() throws Exception { m_buff = IoBuffer.allocate(2); initHeaderBadQos(m_buff); m_buff.flip(); MessageDecoderResult res = m_msgdec.decode(null, m_buff, m_mockProtoDecoder); assertEquals(MessageDecoderResult.NOT_OK, res); }
public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { UnsubscribeMessage message = new UnsubscribeMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } if (message.getQos() != QOSType.LEAST_ONE) { return NOT_OK; } int start = in.position(); message.setMessageID(Utils.readWord(in)); int readed = in.position() - start; while (readed < message.getRemainingLength()) { message.addTopic(Utils.decodeString(in)); readed = in.position() - start; } out.write(message); return OK; }
UnsubscribeDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { UnsubscribeMessage message = new UnsubscribeMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } if (message.getQos() != QOSType.LEAST_ONE) { return NOT_OK; } int start = in.position(); message.setMessageID(Utils.readWord(in)); int readed = in.position() - start; while (readed < message.getRemainingLength()) { message.addTopic(Utils.decodeString(in)); readed = in.position() - start; } out.write(message); return OK; } }
UnsubscribeDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { UnsubscribeMessage message = new UnsubscribeMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } if (message.getQos() != QOSType.LEAST_ONE) { return NOT_OK; } int start = in.position(); message.setMessageID(Utils.readWord(in)); int readed = in.position() - start; while (readed < message.getRemainingLength()) { message.addTopic(Utils.decodeString(in)); readed = in.position() - start; } out.write(message); return OK; }  }
UnsubscribeDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { UnsubscribeMessage message = new UnsubscribeMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } if (message.getQos() != QOSType.LEAST_ONE) { return NOT_OK; } int start = in.position(); message.setMessageID(Utils.readWord(in)); int readed = in.position() - start; while (readed < message.getRemainingLength()) { message.addTopic(Utils.decodeString(in)); readed = in.position() - start; } out.write(message); return OK; }  MessageDecoderResult decodable(IoSession session, IoBuffer in); MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out); }
UnsubscribeDecoder extends MqttDecoder { public MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { UnsubscribeMessage message = new UnsubscribeMessage(); if (decodeCommonHeader(message, in) == NEED_DATA) { return NEED_DATA; } if (message.getQos() != QOSType.LEAST_ONE) { return NOT_OK; } int start = in.position(); message.setMessageID(Utils.readWord(in)); int readed = in.position() - start; while (readed < message.getRemainingLength()) { message.addTopic(Utils.decodeString(in)); readed = in.position() - start; } out.write(message); return OK; }  MessageDecoderResult decodable(IoSession session, IoBuffer in); MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out);  }