### Question:
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); }    }### Answer:
@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); }
@Test public void testMultiTopic() throws Exception { m_buff = Unpooled.buffer(4); SubscribeMessage.Couple c1 = new SubscribeMessage.Couple((byte)2, "a/b"); SubscribeMessage.Couple c2 = new SubscribeMessage.Couple((byte)1, "c/d/e"); initMultiTopic(m_buff, 123, c1, c2); m_msgdec.decode(null, m_buff, m_results); assertFalse(m_results.isEmpty()); SubscribeMessage message = (SubscribeMessage)m_results.get(0); assertEquals(2, message.subscriptions().size()); assertEquals(AbstractMessage.SUBSCRIBE, message.getMessageType()); }