diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCodecTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCodecTest.java
index 097c8ebf90..49722d8eec 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCodecTest.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCodecTest.java
@@ -19,7 +19,9 @@ package org.apache.activemq.transport.mqtt;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import java.net.ProtocolException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -34,6 +36,7 @@ import org.fusesource.mqtt.codec.CONNECT;
import org.fusesource.mqtt.codec.MQTTFrame;
import org.fusesource.mqtt.codec.PUBLISH;
import org.fusesource.mqtt.codec.SUBSCRIBE;
+import org.fusesource.mqtt.codec.UNSUBSCRIBE;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
@@ -254,6 +257,28 @@ public class MQTTCodecTest {
assertEquals(MESSAGE_SIZE, publish.payload().length());
}
+ @Test
+ public void testMessageDecodingCorrupted() throws Exception {
+ UNSUBSCRIBE unsubscribe = new UNSUBSCRIBE();
+
+ MQTTFrame frame = unsubscribe.encode();
+
+ DataByteArrayOutputStream str = new DataByteArrayOutputStream(5);
+ str.write(new byte[] {0,0,0,0,0});
+
+ frame.buffers[0] = str.toBuffer();
+
+ boolean decodingFailed = false;
+ try {
+ unsubscribe.decode(frame);
+ } catch (ProtocolException pe) {
+ decodingFailed = true;
+ }
+ if (!decodingFailed) {
+ fail("Should have failed decoding the frame");
+ }
+ }
+
@Test
public void testMessageDecodingPerformance() throws Exception {
diff --git a/pom.xml b/pom.xml
index 3741241982..2b29ca049d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,7 +97,7 @@
1.10.19
3.3.0
1.6.5
- 1.14
+ 1.15
1.2.0
10.14.2.0
4.3.1