Adapted Unsuscribe decoder to be 3.1.1 compliant
This commit is contained in:
+3
-1
@@ -51,7 +51,9 @@ class UnsubscribeDecoder extends DemuxDecoder {
|
|||||||
message.addTopic(Utils.decodeString(in));
|
message.addTopic(Utils.decodeString(in));
|
||||||
readed = in.readerIndex()- start;
|
readed = in.readerIndex()- start;
|
||||||
}
|
}
|
||||||
|
if (message.topics().isEmpty()) {
|
||||||
|
throw new CorruptedFrameException("unsubscribe MUST have got at least 1 topic");
|
||||||
|
}
|
||||||
out.add(message);
|
out.add(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
@@ -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
|
@Test
|
||||||
public void testDecodeSingleTopic_bug() throws Exception {
|
public void testDecodeSingleTopic_bug() throws Exception {
|
||||||
//A2 0C 00 01 00 06 2F 74 6F 70 69 63 //12 byte
|
//A2 0C 00 01 00 06 2F 74 6F 70 69 63 //12 byte
|
||||||
|
|||||||
Reference in New Issue
Block a user