title: Can't connect to socket.io server with android client
body: <p>For my NodeJS server code, I'm using the <a href="https://github.com/Automattic/socket.io/blob/master/examples/chat/index.js" rel="nofollow">chat server code</a> that is linked to in the <a href="http://socket.io/blog/native-socket-io-and-android/" rel="nofollow">socket io android tutorial</a>. </p>
  
  <p>I'm following the tutorial above to a tee in my android project.</p>
  
  <p><code>build.gradle</code>:</p>
  
  <pre><code>...
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.3.0'
      compile 'com.android.support:design:23.3.0'
      compile 'com.github.nkzawa:socket.io-client:0.3.0'
  }
  </code></pre>
  
  <p><code>AndroidManifest.xml</code>:</p>
  
  <pre><code>...
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  ...
  </code></pre>
  
  <p><code>MainActivity.java</code>:</p>
  
  <pre><code>import com.github.nkzawa.socketio.client.IO;
  import com.github.nkzawa.socketio.client.Socket;
  
  public class MainActivity extends AppCompatActivity {
  
      private Socket mSocket;
      {
          try {
              mSocket = IO.socket("http://localhost:3000");
              Log.e("CONNECTED", "SUCCESS");
          } catch (URISyntaxException e) {
              Log.e("ERROR", "ERROR CONNECTING");
          }
      }
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          mSocket.connect();
          mSocket.emit("message", "message");
      }
  }
  </code></pre>
  
  <p>When I compile this, no matter what I put as the URL for <code>IO.socket(&lt;url&gt;)</code>, it always logs out that it connected. When I load the app, it's supposed to emit <code>message</code> and send <code>"message"</code>, but I never get it on the server. I never even get a "user connected" log in my server log, which I have setup to log out anytime a something connects to it.</p>
  
  <p>Just to test to make sure my server code isn't faulty, I created a client project in NodeJS:</p>
  
  <p><code>client.js</code>:</p>
  
  <pre><code>var io = require('socket.io-client'),
  socket = io.connect('http://localhost:3000');
  
  socket.on('connect', function(){
    console.log("connected")
  });
  </code></pre>
  
  <p>And it and the server both log out 'connected' when I run it. So something is wrong with the java code.... I can't figure it out.</p>