title: EngineIOException: xhr poll error in Android + Socket.io
body: <p>I have the following error while trying to connect to localhost machine:</p>
  
  <pre><code>I/Connection error: Connectio errorio.socket.engineio.client.EngineIOException: xhr poll error
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.util.Log;
  
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import io.socket.client.IO;
  import io.socket.client.Manager;
  import io.socket.client.Socket;
  import io.socket.emitter.Emitter;
  import io.socket.engineio.client.Transport;
  
  public class LoiginActivity extends AppCompatActivity {
      private Socket socket;
      {
          try {
              socket = IO.socket("http://localhost:3000");
  
          } catch (URISyntaxException e) {
              e.printStackTrace();
          }
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_loigin);
  
          socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
              @Override
              public void call(Object... args) {
  
                  Log.i(TAG,"connected");
              }
          });
          socket.on(Socket.EVENT_CONNECT_ERROR, new Emitter.Listener() {
              @Override
              public void call(Object... args) {
                  Log.i(TAG, "Connectin error" + args[0]);
              }
          }); 
  
          socket.connect();   
  
  
      }
  }
  </code></pre>
  
  <p>Internet permissons are set up. <a href="https://stackoverflow.com/questions/37093221/using-socket-io-on-android-always-returns-xhr-poll-error">Using Socket.IO on android Always Returns XHR Poll Error</a> didn't help me</p>