mirror of https://github.com/apache/activemq.git
AMQ-7166 - upgrade mqtt client library
This commit is contained in:
parent
c96f3d75a8
commit
98b9f2e283
|
@ -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 {
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -97,7 +97,7 @@
|
|||
<mockito-version>1.10.19</mockito-version>
|
||||
<owasp-dependency-check-version>3.3.0</owasp-dependency-check-version>
|
||||
<powermock-version>1.6.5</powermock-version>
|
||||
<mqtt-client-version>1.14</mqtt-client-version>
|
||||
<mqtt-client-version>1.15</mqtt-client-version>
|
||||
<openjpa-version>1.2.0</openjpa-version>
|
||||
<org-apache-derby-version>10.14.2.0</org-apache-derby-version>
|
||||
<org.osgi.core-version>4.3.1</org.osgi.core-version>
|
||||
|
|
Loading…
Reference in New Issue