使用版本社区版5.3.1
参数如下:
client = new MqttClient(hostUrl, clientId, new MemoryPersistence());
MqttConnectionOptions options = new MqttConnectionOptions();
options.setUserName(username);
options.setPassword(password.getBytes(StandardCharsets.UTF_8));
options.setConnectionTimeout(5000);
options.setKeepAliveInterval(20);
options.setAutomaticReconnect(true);
options.setCleanStart(false);
options.setSessionExpiryInterval(600L);
会什么不会自动连接?