提交 13119f44 编写于 作者: 如梦技术's avatar 如梦技术 🐛

测试代码优化

上级 4a15489d
......@@ -17,7 +17,7 @@
package net.dreamlu.iot.mqtt.client;
import net.dreamlu.iot.mqtt.codec.ByteBufferUtil;
import net.dreamlu.iot.mqtt.codec.MqttVersion;
import net.dreamlu.iot.mqtt.codec.MqttQoS;
import net.dreamlu.iot.mqtt.core.client.MqttClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -46,9 +46,15 @@ public class MqttClientTest {
// .readBufferSize(1024 * 10)
// 最大包体长度,如果包体过大需要设置此参数
// .maxBytesInMessage(1024 * 10)
.version(MqttVersion.MQTT_5)
// .version(MqttVersion.MQTT_5)
// 连接监听
.connectListener(new MqttClientConnectListener())
.willMessage(builder -> {
builder.topic("/test/offline")
.messageText("down")
.retain(false)
.qos(MqttQoS.AT_MOST_ONCE); // 遗嘱消息
})
.connect();
client.subQos0("/test/#", (topic, payload) -> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册