Q:

MqttException on Android

I have been following Dale Lane's blog to access Mosquitto through my Android project, but am stuck at the first step.  Here is the relevant portion of the logs :
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.<init>(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

The exception is thrown at the "connectToBroker()" method of Dale's code :
mqttClient.connect("_unique_client_id", true, (short) 2000);     //tried many permutations

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. 
Thanks a lot ! 

A:

Thanks Dale, I just had to change the localhost address to 10.0.2.2, rest was all smooth.