From ad3041034b3a0d126575297821425f7bbca977f0 Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Thu, 23 Jan 2014 13:23:01 -0500 Subject: [PATCH] Implements AMQ-4990: Add support for the changes in MQTT 3.1.1 --- .../transport/mqtt/MQTTProtocolConverter.java | 7 ++++--- .../apache/activemq/transport/mqtt/MQTTTest.java | 14 +++++++++++++- pom.xml | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java index 34f53a4554..9c6fa12676 100644 --- a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java +++ b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java @@ -124,12 +124,13 @@ public class MQTTProtocolConverter { break; } case CONNECT.TYPE: { - onMQTTConnect(new CONNECT().decode(frame)); - LOG.debug("MQTT Client " + getClientId() + " connected."); + CONNECT connect = new CONNECT().decode(frame); + onMQTTConnect(connect); + LOG.debug("MQTT Client {} connected. (version: {})", getClientId(), connect.version()); break; } case DISCONNECT.TYPE: { - LOG.debug("MQTT Client " + getClientId() + " disconnecting"); + LOG.debug("MQTT Client {} disconnecting", getClientId()); onMQTTDisconnect(); break; } diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java index bf4fac5e19..64a9b5f61f 100644 --- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java +++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java @@ -668,9 +668,21 @@ public class MQTTTest extends AbstractMQTTTest { @Override public void debug(String message, Object... args) { - LOG.info(message, args); + LOG.info(String.format(message, args)); } }; } + @Test(timeout=60 * 1000) + public void testMQTT311Connection()throws Exception{ + addMQTTConnector(); + brokerService.start(); + MQTT mqtt = createMQTTConnection(); + mqtt.setClientId("foo"); + mqtt.setVersion("3.1.1"); + final BlockingConnection connection = mqtt.blockingConnection(); + connection.connect(); + connection.disconnect(); + } + } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 645c353ac2..e3a0b3ce74 100755 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ 1.0 1.0.0 1.9 - 1.18 + 1.19 0.1.8 1.8.0.12 4.2.5 @@ -90,7 +90,7 @@ 0.6 1.8 1.2.17 - 1.6 + 1.7 1.2.0 2.4.2 10.10.1.1