Skip to content

Commit

Permalink
Updated test to use QoS1 to be sure at least 1 publish reaches the su…
Browse files Browse the repository at this point in the history
…bscriber
  • Loading branch information
andsel committed Nov 23, 2024
1 parent f7e65d3 commit ead2edd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ public void givenAPublishWithPayloadFormatIndicatorWhenForwardedToSubscriberThen
Mqtt5BlockingClient subscriber = createSubscriberClient();
Mqtt5SubAck subAck = subscriber.subscribeWith()
.topicFilter("temperature/living")
.qos(MqttQos.AT_MOST_ONCE)
.qos(MqttQos.AT_LEAST_ONCE)
.send();
assertThat(subAck.getReasonCodes()).contains(Mqtt5SubAckReasonCode.GRANTED_QOS_0);
assertThat(subAck.getReasonCodes()).contains(Mqtt5SubAckReasonCode.GRANTED_QOS_1);
LOG.info("SUBACK received");

Mqtt5BlockingClient publisher = createPublisherClient();
publisher.publishWith()
.topic("temperature/living")
.payload("18".getBytes(StandardCharsets.UTF_8))
.payloadFormatIndicator(Mqtt5PayloadFormatIndicator.UTF_8)
.qos(MqttQos.AT_MOST_ONCE)
.qos(MqttQos.AT_LEAST_ONCE)
.send();
LOG.info("PUB QoS0 sent");
LOG.info("PUB QoS1 sent");

verifyPublishMessage(subscriber, msgPub -> {
assertTrue(msgPub.getPayloadFormatIndicator().isPresent());
Expand Down

0 comments on commit ead2edd

Please sign in to comment.