diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java index 7ffb3e80ab..98ba8c985f 100644 --- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java +++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java @@ -253,6 +253,30 @@ public class MQTTAuthTest extends MQTTAuthTestSupport { connectionSub.subscribe(new Topic[]{new Topic("#", QoS.AT_LEAST_ONCE)}); Message msg = connectionSub.receive(1, TimeUnit.SECONDS); assertNull("Shouldn't receive the message", msg); + + } + + @Test(timeout = 60 * 1000) + public void testWildcardRetainedSubscriptionLocked() throws Exception { + MQTT mqttPub = createMQTTConnection("pub", true); + mqttPub.setUserName("admin"); + mqttPub.setPassword("admin"); + + getProxyToBroker().addTopic("one.foo"); + BlockingConnection connectionPub = mqttPub.blockingConnection(); + connectionPub.connect(); + connectionPub.publish("one/foo", "test".getBytes(), QoS.AT_LEAST_ONCE, true); + + MQTT mqttSub = createMQTTConnection("sub", true); + mqttSub.setUserName("user"); + mqttSub.setPassword("password"); + BlockingConnection connectionSub = mqttSub.blockingConnection(); + connectionSub.connect(); + connectionSub.subscribe(new Topic[]{new Topic("+/#", QoS.AT_LEAST_ONCE)}); + Message msg = connectionSub.receive(1, TimeUnit.SECONDS); + assertNull("Shouldn't receive the message", msg); + + assertEquals(1, getProxyToTopic("one.foo").getEnqueueCount()); } @Test(timeout = 60 * 1000)