title: Android rest web services call, Connections refuse issue
body: <p>I'm developing a android application and calling REST web services.It gives a error<br>
  This is my log  </p>
  
  <pre><code>05-31 12:23:34.355: W/System.err(766): org.apache.http.conn.HttpHostConnectException: Connection to http://myip:8084 refused  
  05-31 12:23:34.365: W/System.err(766): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)  
  05-31 12:23:34.365: W/System.err(766):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
  05-31 12:23:34.365: W/System.err(766):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
  05-31 12:23:34.365: W/System.err(766):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
  05-31 12:23:34.375: W/System.err(766):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)  
  05-31 12:23:34.375: W/System.err(766):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
  05-31 12:23:34.375: W/System.err(766):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
  05-31 12:23:34.375: W/System.err(766):  at com.example.locationtracker.RestWSUser.sendThroughHttpGet(RestWSUser.java:38)
  05-31 12:23:34.375: W/System.err(766):  at com.example.locationtracker.MainActivity.checkIn(MainActivity.java:38)
  05-31 12:23:34.375: W/System.err(766):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-31 12:23:34.375: W/System.err(766):  at java.lang.reflect.Method.invoke(Method.java:511)
  05-31 12:23:34.385: W/System.err(766):  at android.view.View$1.onClick(View.java:3594)
  05-31 12:23:34.385: W/System.err(766):  at android.view.View.performClick(View.java:4204)
  05-31 12:23:34.385: W/System.err(766):  at android.view.View$PerformClick.run(View.java:17355)
  05-31 12:23:34.395: W/System.err(766):  at android.os.Handler.handleCallback(Handler.java:725)
  05-31 12:23:34.395: W/System.err(766):  at android.os.Handler.dispatchMessage(Handler.java:92)
  05-31 12:23:34.395: W/System.err(766):  at android.os.Looper.loop(Looper.java:137)
  05-31 12:23:34.395: W/System.err(766):  at android.app.ActivityThread.main(ActivityThread.java:5041)
  05-31 12:23:34.395: W/System.err(766):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-31 12:23:34.395: W/System.err(766):  at java.lang.reflect.Method.invoke(Method.java:511)
  05-31 12:23:34.395: W/System.err(766):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  05-31 12:23:34.405: W/System.err(766):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  05-31 12:23:34.405: W/System.err(766):  at dalvik.system.NativeStart.main(Native Method)
  05-31 12:23:34.405: W/System.err(766): Caused by: java.net.ConnectException: socket failed: EACCES (Permission denied)
  05-31 12:23:34.415: W/System.err(766):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:181)
  05-31 12:23:34.415: W/System.err(766):  ... 22 more
  05-31 12:23:34.415: W/System.err(766): Caused by: java.net.SocketException: socket failed: EACCES (Permission denied)
  05-31 12:23:34.435: W/System.err(766):  at libcore.io.IoBridge.socket(IoBridge.java:583)
  05-31 12:23:34.435: W/System.err(766):  at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201)
  05-31 12:23:34.435: W/System.err(766):  at java.net.Socket.checkOpenAndCreate(Socket.java:663)
  05-31 12:23:34.445: W/System.err(766):  at java.net.Socket.connect(Socket.java:807)
  05-31 12:23:34.445: W/System.err(766):  at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
  05-31 12:23:34.445: W/System.err(766):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
  05-31 12:23:34.445: W/System.err(766):  ... 22 more
  05-31 12:23:34.455: W/System.err(766): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
  05-31 12:23:34.465: W/System.err(766):  at libcore.io.Posix.socket(Native Method)
  05-31 12:23:34.465: W/System.err(766):  at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
  </code></pre>
  
  <p>This is my java code  </p>
  
  <pre><code>HttpGet httpGet = new HttpGet("http://myip:8084/rest/loc/test/7225");
      HttpParams params = new BasicHttpParams();
      HttpConnectionParams.setStaleCheckingEnabled(params, false);
      HttpConnectionParams.setConnectionTimeout(params, 30000);
      HttpConnectionParams.setSoTimeout(params, 30000);
      HttpClient httpClient = new DefaultHttpClient(params);
      HttpResponse httpResponse = httpClient.execute(httpGet);
      InputStream inputStream = httpResponse.getEntity().getContent();
      BufferedReader bufferedReader = new BufferedReader(
              new InputStreamReader(inputStream));
      StringBuilder responseStr = new StringBuilder();
      String responseLineStr = null;
      while ((responseLineStr = bufferedReader.readLine()) != null) {
          responseStr.append(responseLineStr);
      } 
  </code></pre>
  
  <p>This is my Manifest file permission list  </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/&gt;
  &lt;user-permission android:name="android.permission.INTERNET"/&gt;
  &lt;user-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  </code></pre>
  
  <p>What can be the reason for this, services are working<br>
  Thanks </p>