title: MqttException on Android
body: <p>I have been following <a href="http://dalelane.co.uk/blog/?p=1599" rel="nofollow">Dale Lane's blog</a> to access Mosquitto through my Android project, but am stuck at the first step. Here is the relevant portion of the logs :</p>
  
  <pre><code>02-24 20:43:17.324: WARN/System.err(316): com.ibm.mqtt.MqttException
  02-24 20:43:17.534: WARN/System.err(316):     at com.ibm.mqtt.MqttBaseClient.doConnect(Unknown Source)
  02-24 20:43:17.534: WARN/System.err(316):     at com.ibm.mqtt.MqttBaseClient.connect(Unknown Source)
  02-24 20:43:17.534: WARN/System.err(316):     at com.ibm.mqtt.MqttClient.connect(Unknown Source)
  02-24 20:43:17.534: WARN/System.err(316):     at com.ibm.mqtt.MqttClient.connect(Unknown Source)
  02-24 20:43:17.534: WARN/System.err(316):     at com.push.MQTTService.connectToBroker(MQTTService.java:665)
  02-24 20:43:17.584: WARN/System.err(316):     at com.push.MQTTService.handleStart(MQTTService.java:294)
  02-24 20:43:17.584: WARN/System.err(316):     at com.push.MQTTService.onStartCommand(MQTTService.java:210)
  02-24 20:43:17.594: WARN/System.err(316):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053)
  02-24 20:43:17.594: WARN/System.err(316):     at android.app.ActivityThread.access$3600(ActivityThread.java:125)
  02-24 20:43:17.594: WARN/System.err(316):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
  02-24 20:43:17.594: WARN/System.err(316):     at android.os.Handler.dispatchMessage(Handler.java:99)
  
  02-24 20:43:20.107: WARN/System.err(316):     at com.ibm.mqtt.MqttBaseClient.doConnect(Unknown Source)
  02-24 20:43:20.107: WARN/System.err(316):     at com.ibm.mqtt.MqttBaseClient.connect(Unknown Source)
  02-24 20:43:20.114: WARN/System.err(316):     at com.ibm.mqtt.MqttClient.connect(Unknown Source)
  02-24 20:43:20.124: WARN/System.err(316):     at com.ibm.mqtt.MqttClient.connect(Unknown Source)
  02-24 20:43:20.124: WARN/System.err(316):     at com.push.MQTTService.connectToBroker(MQTTService.java:665)
  02-24 20:43:20.124: WARN/System.err(316):     at com.push.MQTTService.access$6(MQTTService.java:658)
  02-24 20:43:20.124: WARN/System.err(316):     at com.push.MQTTService$NetworkConnectionIntentReceiver.onReceive(MQTTService.java:883)
  
  02-24 20:43:20.274: WARN/System.err(316): Caused by: java.net.ConnectException: /127.0.0.5:1883 - Connection refused
  02-24 20:43:20.304: WARN/System.err(316):     at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:254)
  02-24 20:43:20.344: WARN/System.err(316):     at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
  02-24 20:43:20.344: WARN/System.err(316):     at java.net.Socket.connect(Socket.java:1055)
  02-24 20:43:20.344: WARN/System.err(316):     at com.ibm.mqtt.j2se.MqttJava14NetSocket.&lt;init&gt;(Unknown Source)
  02-24 20:43:20.344: WARN/System.err(316):     at com.ibm.mqtt.j2se.MqttJavaNetSocket.setConnection(Unknown Source)
  02-24 20:43:20.376: WARN/System.err(316):     at com.ibm.mqtt.Mqtt.tcpipConnect(Unknown Source)
  
  02-24 20:47:17.677: DEBUG/SntpClient(65): request time failed: java.net.SocketException: Address family not supported by protocol
  </code></pre>
  
  <p>The exception is thrown at the "connectToBroker()" method of Dale's code :</p>
  
  <pre><code>mqttClient.connect("_unique_client_id", true, (short) 2000);     //tried many permutations
  </code></pre>
  
  <p>I am running Mosquitto broker on the same machine as the client. I can publish/subscribe to the broker through the IA92 client provided in the samples.I am also able to connect through a simple java project with the same service parameters.</p>
  
  <p>Thanks a lot !</p>