@Test public void testClientSubscribeBeforeRetainedQoS2IsSent() { subscribe(EXACTLY_ONCE, "/topic", connection); // Exercise internalPublishTo("/topic", EXACTLY_ONCE, true); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, EXACTLY_ONCE, PAYLOAD); }
@Test public void testClientSubscribeAfterRetainedQoS2IsSent() { // Exercise internalPublishTo("/topic", EXACTLY_ONCE, true); subscribe(EXACTLY_ONCE, "/topic", connection); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, EXACTLY_ONCE, PAYLOAD); }
@Test public void testClientSubscribeAfterRetainedQoS0IsSent() { // Exercise final String topic = "/topic"; internalPublishRetainedTo(topic); subscribe(AT_MOST_ONCE, topic, connection); // Verify verifyNoPublishIsReceived(channel); }
@Test public void testClientSubscribeBeforeNotRetainedQoS0IsSent() { subscribe(AT_MOST_ONCE, "/topic", connection); // Exercise internalPublishNotRetainedTo("/topic"); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, AT_MOST_ONCE, PAYLOAD); }
@Test public void testClientSubscribeBeforeRetainedQoS1IsSent() { subscribe(AT_LEAST_ONCE, "/topic", connection); // Exercise internalPublishTo("/topic", AT_LEAST_ONCE, true); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, AT_LEAST_ONCE, PAYLOAD); }
@Test public void testClientSubscribeBeforeNotRetainedQoS2IsSent() { subscribe(EXACTLY_ONCE, "/topic", connection); // Exercise internalPublishTo("/topic", EXACTLY_ONCE, false); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, EXACTLY_ONCE, PAYLOAD); }
@Test public void testClientSubscribeBeforeNotRetainedQoS1IsSent() { subscribe(AT_LEAST_ONCE, "/topic", connection); // Exercise internalPublishTo("/topic", AT_LEAST_ONCE, false); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, AT_LEAST_ONCE, PAYLOAD); }
@Test public void testClientSubscribeAfterNotRetainedQoS1IsSent() { // Exercise internalPublishTo("/topic", AT_LEAST_ONCE, false); subscribe(AT_LEAST_ONCE, "/topic", connection); // Verify verifyNoPublishIsReceived(channel); }
@Test public void testClientSubscribeAfterNotRetainedQoS0IsSent() { // connection.processConnect(connectMessage); // ConnectionTestUtils.assertConnectAccepted(channel); // Exercise final String topic = "/topic"; internalPublishNotRetainedTo(topic); subscribe(AT_MOST_ONCE, topic, connection); // Verify verifyNoPublishIsReceived(channel); }
@Test public void testClientSubscribeBeforeRetainedQoS0IsSent() { subscribe(AT_MOST_ONCE, "/topic", connection); // Exercise internalPublishRetainedTo("/topic"); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, AT_MOST_ONCE, PAYLOAD); }
@Test public void testClientSubscribeAfterRetainedQoS1IsSent() { // Exercise internalPublishTo("/topic", AT_LEAST_ONCE, true); subscribe(AT_LEAST_ONCE, "/topic", connection); // Verify ConnectionTestUtils.verifyPublishIsReceived(channel, AT_LEAST_ONCE, PAYLOAD); }
@Test public void testClientSubscribeAfterNotRetainedQoS2IsSent() { // Exercise internalPublishTo("/topic", EXACTLY_ONCE, false); subscribe(EXACTLY_ONCE, "/topic", connection); // Verify verifyNoPublishIsReceived(channel); }
@Test public void testClientSubscribeAfterDisconnected() { subscribe(AT_MOST_ONCE, "foo", connection); connection.processDisconnect(null); internalPublishTo("foo", AT_MOST_ONCE, false); verifyNoPublishIsReceived(channel); }
@Test public void testClientSubscribeWithoutCleanSession() { subscribe(AT_MOST_ONCE, "foo", connection); connection.processDisconnect(null); assertEquals(1, subscriptions.size()); MQTTConnection anotherConn = createMQTTConnection(CONFIG); MqttConnectMessage connectMessage = MqttMessageBuilders.connect() .clientId(FAKE_CLIENT_ID) .cleanSession(false) .build(); anotherConn.processConnect(connectMessage); ConnectionTestUtils.assertConnectAccepted((EmbeddedChannel) anotherConn.channel); assertEquals(1, subscriptions.size()); internalPublishTo("foo", MqttQoS.AT_MOST_ONCE, false); ConnectionTestUtils.verifyPublishIsReceived((EmbeddedChannel) anotherConn.channel, AT_MOST_ONCE, PAYLOAD); }