title: android websocket connection timeout with wAsync (atmosphere)
body: <p>I previously wrote a Java SE client based on wAsync. It works rock-solid with version 1.0.RC1 connected to Atmosphere 1.1.RC1. I followed this example from Jeanfrancois to accomplish <a href="https://github.com/Atmosphere/wasync/blob/master/samples/android-chat/src/main/java/org/atmosphere/wasync/andoid/wAsyncChat.java" rel="nofollow">this task</a></p>
  
  <p>Everything works, JSON encoding, subscribing, broadcasting and sending a POST to a URI. Good so far.</p>
  
  <p>However, putting this example to Android would raise a timeout exception when trying to subscribe to a resource. As you can see in the log, I wanted to open a socket on </p>
  
  <pre><code>http://localhost:8080/resource/playerpool
  </code></pre>
  
  <p>Again, this worked fine on the Java SE 6 client.</p>
  
  <p>Anyone has a clue why this would run into a timeout on the Android emulator while being the exact code from the Java SE client?</p>
  
  <p>I did set the permission in the AndroidManifest.xml</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  </code></pre>
  
  <p>Below the Android log, when trying to open the connection on the socket. </p>
  
  <pre><code>04-24 06:27:41.043: W/System.err(1512): java.net.ConnectException: connection timed out to ws://localhost:8080/resource/playerpool?X-Atmosphere-Transport=long-polling&amp;X-atmo-protocol=true&amp;X-Atmosphere-tracking-id=0&amp;X-Atmosphere-Framework=1.0&amp;X-Cache-Date=0
  04-24 06:27:41.051: W/System.err(1512):     at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:103)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:418)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:380)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:139)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:82)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:41)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
  04-24 06:27:41.051: W/System.err(1512):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  04-24 06:27:41.051: W/System.err(1512):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  04-24 06:27:41.051: W/System.err(1512):     at java.lang.Thread.run(Thread.java:856)
  04-24 06:27:41.051: W/System.err(1512): Caused by: java.net.ConnectException: connection timed out
  04-24 06:27:41.051: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:136)
  04-24 06:27:41.051: W/System.err(1512):     ... 8 more
  04-24 06:27:41.063: W/System.err(1512): java.util.concurrent.ExecutionException: java.net.ConnectException: connection timed out to ws://localhost:8080/rest-group-e/playerpool?X-Atmosphere-Transport=long-polling&amp;X-atmo-protocol=true&amp;X-Atmosphere-tracking-id=0&amp;X-Atmosphere-Framework=1.0&amp;X-Cache-Date=0
  04-24 06:27:41.063: W/System.err(1512):     at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:327)
  04-24 06:27:41.063: W/System.err(1512):     at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:107)
  04-24 06:27:41.063: W/System.err(1512):     at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:418)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:380)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:139)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:82)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:41)
  04-24 06:27:41.074: W/System.err(1512):     at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  04-24 06:27:41.083: W/System.err(1512):     at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
  04-24 06:27:41.083: W/System.err(1512):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  04-24 06:27:41.083: W/System.err(1512):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  04-24 06:27:41.083: W/System.err(1512):     at java.lang.Thread.run(Thread.java:856)
  04-24 06:27:41.083: W/System.err(1512): Caused by: java.net.ConnectException: connection timed out to ws://localhost:8080/rest-group-e/playerpool?X-Atmosphere-Transport=long-polling&amp;X-atmo-protocol=true&amp;X-Atmosphere-tracking-id=0&amp;X-Atmosphere-Framework=1.0&amp;X-Cache-Date=0
  04-24 06:27:41.083: W/System.err(1512):     at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:103)
  04-24 06:27:41.083: W/System.err(1512):     ... 12 more
  04-24 06:27:41.083: W/System.err(1512): Caused by: java.net.ConnectException: connection timed out
  04-24 06:27:41.083: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:136)
  04-24 06:27:41.083: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:82)
  04-24 06:27:41.083: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
  04-24 06:27:41.083: W/System.err(1512):     at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:41)
  04-24 06:27:41.083: W/System.err(1512):     ... 3 more
  </code></pre>