Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for MQTT5 changes #168

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/io/vertx/mqtt/impl/MqttClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ public Future<Integer> subscribe(Map<String, Integer> topics) {
false,
0);

MqttMessageIdAndPropertiesVariableHeader variableHeader = new MqttMessageIdAndPropertiesVariableHeader(nextMessageId(), new MqttProperties());
MqttMessageIdVariableHeader variableHeader = new MqttMessageIdAndPropertiesVariableHeader(nextMessageId(), MqttProperties.NO_PROPERTIES);
List<MqttTopicSubscription> subscriptions = topics.entrySet()
.stream()
.map(e -> new MqttTopicSubscription(e.getKey(), valueOf(e.getValue())))
Expand Down Expand Up @@ -635,7 +635,7 @@ public Future<Integer> unsubscribe(String topic) {
false,
0);

MqttMessageIdAndPropertiesVariableHeader variableHeader = new MqttMessageIdAndPropertiesVariableHeader(nextMessageId(), new MqttProperties());
MqttMessageIdVariableHeader variableHeader = new MqttMessageIdAndPropertiesVariableHeader(nextMessageId(), MqttProperties.NO_PROPERTIES);

MqttUnsubscribePayload payload = new MqttUnsubscribePayload(Stream.of(topic).collect(Collectors.toList()));

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/vertx/mqtt/impl/MqttEndpointImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,9 @@ public MqttEndpointImpl unsubscribeAcknowledge(int unsubscribeMessageId) {
new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
MqttMessageIdVariableHeader variableHeader =
MqttMessageIdVariableHeader.from(unsubscribeMessageId);
MqttUnsubAckPayload payload = new MqttUnsubAckPayload();

io.netty.handler.codec.mqtt.MqttMessage unsuback = MqttMessageFactory.newMessage(fixedHeader, variableHeader, new MqttUnsubAckPayload());
io.netty.handler.codec.mqtt.MqttMessage unsuback = MqttMessageFactory.newMessage(fixedHeader, variableHeader, payload);

this.write(unsuback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void subscribe(TestContext context, String topic, int expectedQos) {
}

@Test
public void subscribeUnsupportedQos(TestContext context) {
public void subscribeUnsupportedMqttVersion(TestContext context) {

Async async = context.async();

Expand All @@ -122,8 +122,8 @@ public void subscribeUnsupportedQos(TestContext context) {
0x11, // MSG LEN
0x00, 0x04, // PROTOCOL NAME LENGTH
0x4D, 0x51, 0x54, 0x54, // MQTT
0x03, // LEVEL
0x02, // FLAGS
0x06, // VERSION
0x02, // QOS
0x00, 0x3C, // KEEP ALIVE
0x00, 0x05, // CLIENT ID LENGTH
0x31, 0x32, 0x33, 0x34, 0x35, // CLIENT ID (12345)
Expand Down