Adapted Unsuscribe decoder to be 3.1.1 compliant

This commit is contained in:
selva.andre
2014-08-02 12:34:03 +02:00
parent d1b54eb8cf
commit f343ce3094
2 changed files with 12 additions and 1 deletions
@@ -51,7 +51,9 @@ class UnsubscribeDecoder extends DemuxDecoder {
message.addTopic(Utils.decodeString(in));
readed = in.readerIndex()- start;
}
if (message.topics().isEmpty()) {
throw new CorruptedFrameException("unsubscribe MUST have got at least 1 topic");
}
out.add(message);
}
@@ -72,6 +72,15 @@ public class UnsubscribeDecoderTest {
}
@Test(expected = CorruptedFrameException.class)
public void testFailOnEmptyTopic() throws Exception {
m_buff = Unpooled.buffer(4);
initMultiTopic(m_buff, 123);
//Excercise
m_msgdec.decode(null, m_buff, m_results);
}
@Test
public void testDecodeSingleTopic_bug() throws Exception {
//A2 0C 00 01 00 06 2F 74 6F 70 69 63 //12 byte