I'm having some trouble using the Eclipse Paho async MQTT client with a CloudMQTT server instance running under Android. Is this the correct way to specify username / passwords?
mClient = new MqttAsyncClient( "tcp://xxx.cloudmqtt.com:11729", "TestGuy", new MemoryPersistence() );
// Set up connection options
connOpts = new MqttConnectOptions();
connOpts.setCleanSession( true );
connOpts.setUserName( "usr" );
connOpts.setPassword( "pwd".toCharArray() );
// Attempt to connect
mClient.connect( connOpts, this );
I keep getting "Not authorized to connect" in my onFailure() handler.
I can connect absolutely fine using the mosquitto_pub & sub tools, the M2Mqtt .NET client, the Paho C client and the "MyMQTT" Android app running on the same phone I am trying to connect from using the above code.
I am running the latest version "org.eclipse.paho.client.mqttv3-1.0.2.jar"
Thank you