@Test(expected = CorruptedFrameException.class) public void testBadQos() throws Exception { m_buff = Unpooled.buffer(2); initHeaderBadQos(m_buff); m_msgdec.decode(null, m_buff, m_results); }
@Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { SubscribeMessage message = new SubscribeMessage(); in.resetReaderIndex(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } if (message.getQos() != QOSType.LEAST_ONE) { throw new CorruptedFrameException("Received Subscribe message with QoS other than LEAST_ONE, was: " + message.getQos()); } int start = in.readerIndex(); message.setMessageID(in.readUnsignedShort()); int readed = in.readerIndex() - start; while (readed < message.getRemainingLength()) { decodeSubscription(in, message); readed = in.readerIndex()- start; } out.add(message); }
SubscribeDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { SubscribeMessage message = new SubscribeMessage(); in.resetReaderIndex(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } if (message.getQos() != QOSType.LEAST_ONE) { throw new CorruptedFrameException("Received Subscribe message with QoS other than LEAST_ONE, was: " + message.getQos()); } int start = in.readerIndex(); message.setMessageID(in.readUnsignedShort()); int readed = in.readerIndex() - start; while (readed < message.getRemainingLength()) { decodeSubscription(in, message); readed = in.readerIndex()- start; } out.add(message); } }
SubscribeDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { SubscribeMessage message = new SubscribeMessage(); in.resetReaderIndex(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } if (message.getQos() != QOSType.LEAST_ONE) { throw new CorruptedFrameException("Received Subscribe message with QoS other than LEAST_ONE, was: " + message.getQos()); } int start = in.readerIndex(); message.setMessageID(in.readUnsignedShort()); int readed = in.readerIndex() - start; while (readed < message.getRemainingLength()) { decodeSubscription(in, message); readed = in.readerIndex()- start; } out.add(message); }  }
SubscribeDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { SubscribeMessage message = new SubscribeMessage(); in.resetReaderIndex(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } if (message.getQos() != QOSType.LEAST_ONE) { throw new CorruptedFrameException("Received Subscribe message with QoS other than LEAST_ONE, was: " + message.getQos()); } int start = in.readerIndex(); message.setMessageID(in.readUnsignedShort()); int readed = in.readerIndex() - start; while (readed < message.getRemainingLength()) { decodeSubscription(in, message); readed = in.readerIndex()- start; } out.add(message); }   }
SubscribeDecoder extends DemuxDecoder { @Override void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { SubscribeMessage message = new SubscribeMessage(); in.resetReaderIndex(); if (!decodeCommonHeader(message, in)) { in.resetReaderIndex(); return; } if (message.getQos() != QOSType.LEAST_ONE) { throw new CorruptedFrameException("Received Subscribe message with QoS other than LEAST_ONE, was: " + message.getQos()); } int start = in.readerIndex(); message.setMessageID(in.readUnsignedShort()); int readed = in.readerIndex() - start; while (readed < message.getRemainingLength()) { decodeSubscription(in, message); readed = in.readerIndex()- start; } out.add(message); }    }