eclipse-paho / eclipse-paho/paho.mqtt.java
Subcribe can't work in the method with @Test
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 919
- PR merge metrics
- No merged PRs in 30d
Description
I have found that the client.subcribe() can not work in the @Test, but client.publish() work.
My code is as follows:
`
String host = "tcp://***.**.**.**:1883";
String clientid = UUID.randomUUID().toString();
MqttClient client = new MqttClient(host, clientid, new MemoryPersistence());
MqttConnectOptions options = new MqttConnectOptions();
options.setCleanSession(true);
options.setConnectionTimeout(10);
options.setKeepAliveInterval(20);
client.setCallback(new MessageCallback());
client.connect(options);
client.subscribe("topic", 0);
`
It can successfully connect but will trigger socker error.
This problem only exits in the @Test.
- [x] Bug exists Release Version 1.2.3 ( Master Branch)
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.4-SNAPSHOT (Develop Branch)
- [ ] Bug exists in MQTTv5 Client on Snapshot Version 1.2.3-SNAPSHOT (Develop Branch)
If this is a bug regarding the Android Service, please raise the bug here instead: https://github.com/eclipse/paho.mqtt.android/issues/new
Contributor guide
Assessment
This issue has not been assessed yet.