title: Paho MqttAndroidClient.connect always fails
body: <p>I'd like to publish messages from an android <code>service</code> to a local server. Here is parts of my code in the simplest form based on snippets from <a href="https://stackoverflow.com/questions/24791118/android-paho-mqtt-service-for-publishing">here</a>.</p>
  
  <pre><code>MemoryPersistence memPer;
  MqttAndroidClient client;
  
  @Override
  public IBinder onBind(Intent intent) {
      memPer = new MemoryPersistence();
      client = new MqttAndroidClient(this, "tcp://192.168.1.42:1883", "clientid", memPer);
  
      try {
          client.connect(null, new IMqttActionListener() {
  
              @Override
              public void onSuccess(IMqttToken mqttToken) {
                  Log.i("MQTT", "Client connected");
                  Log.i("MQTT", "Topics=" + mqttToken.getTopics());
  
                  MqttMessage message = new MqttMessage("Hello, I am Android Mqtt Client.".getBytes());
                  message.setQos(2);
                  message.setRetained(false);
  
                  try {
                      client.publish("messages", message);
  
                      Log.i("MQTT", "Message published");
  
                      client.disconnect();
                      Log.i("MQTT", "client disconnected");
                  } catch (MqttPersistenceException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  } catch (MqttException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
  
  
              }
  
              @Override
              public void onFailure(IMqttToken arg0, Throwable arg1) {
                  // TODO Auto-generated method stub
                  Log.i("MQTT", "Client connection failed: " + arg1.getMessage());
              }
          });
      } catch (MqttException e) {
          e.printStackTrace();
      }
  
      return mBinder;
  }
  </code></pre>
  
  <p>But the onFailure function is always called and I get the error:</p>
  
  <pre><code>I/MQTT﹕ Client connection failed: cannot start service org.eclipse.paho.android.service.MqttService
  </code></pre>
  
  <p>Apparently returned by the library because 'listener != null', <a href="http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/tree/org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/MqttAndroidClient.java" rel="noreferrer">Line 410</a>. Using the debugger, it shows that 'listener = SensorLoggerService$1@3634'. SensorLoggerService is my service.</p>
  
  <p>Any idea what could be going wrong? Thanks a lot.</p>