https://issues.apache.org/jira/browse/AMQ-5734 - fix intermittent failure - seems the retained empty message gets dispatched so we need to consume it or it may have been dispatched to the client, causing a later failure

This commit is contained in:
gtully 2015-04-28 16:15:18 +01:00
parent 9ef4259297
commit f5283a9045
1 changed files with 8 additions and 0 deletions

View File

@ -167,6 +167,13 @@ public class MQTTAuthTest extends MQTTAuthTestSupport {
//delete retained message
connection.publish(ANONYMOUS, "".getBytes(), QoS.AT_MOST_ONCE, true);
// that delete retained message gets dispatched! Wonder if that is expected?
// guess it is simpler if it is - it shows up on the assertNull:196 below on occasion
msg = connection.receive(1000, TimeUnit.MILLISECONDS);
assertNotNull(msg);
assertEquals(ANONYMOUS, new String(msg.getTopic()));
msg.ack();
connection.disconnect();
// Test 3.1 functionality
@ -185,6 +192,7 @@ public class MQTTAuthTest extends MQTTAuthTestSupport {
connectionPub.publish(NAMED, NAMED.getBytes(), QoS.AT_MOST_ONCE, true);
msg = connection.receive(1000, TimeUnit.MILLISECONDS);
LOG.info("got msg: " + msg + ", " + (msg != null ? new String(msg.getTopic()) : ""));
assertNull(msg);
}