title: Android: Has anyone encountered the localhost HttpClient Connection Refused error?
body: <p>I was just wondering if anyone solved this problem. Googling gives tons of posts having this question but not one with a proper reply. I tried literally every combination of the following two pieces of code with and without proxy: </p>
  
  <pre><code>/*********** URL METHOD ***************/
  //URLConnection conn = aURL.openConnection(); 
  //conn.connect(); 
  //InputStream is = conn.getInputStream(); 
  
  /*********** HTTP METHOD ***************/
  HttpClient client = new DefaultHttpClient();
  HttpGet get = new HttpGet(urlString);
  HttpResponse resp = client.execute(get);
  
  InputStream is = resp.getEntity().getContent();
  </code></pre>
  
  <p>I am trying to connect to a site on my intranet (its not localhost). I've tried the following:</p>
  
  <ol>
  <li>Setting Proxy inside Eclipse settings</li>
  <li>Setting my own localhost and writing a small php script that takes the url, connects to it and then gets the file from the intranet site - This works from the Browser though! It does not work when I use the 10.0.2.2 IP address</li>
  </ol>
  
  <p>Any thoughts?</p>