title: Connect to GlassFish server using HttpURLConnection in Android
body: <p>I am developing an Android application that accesses a remote server using HttpURLConnection.</p>
  
  <p>The server was (and still is) developed using NetBeans so, when testing the server on my local machine, I run it using NetBeans and the built-in GlassFish server.</p>
  
  <p>I have tried to connect to the running server in Eclipse using HttpURLConnection giving localhost as the server (with the socket) but keep getting Connection Refused.</p>
  
  <p>I can still access the local server from my browser with no problem but can't get to it from Eclipse.</p>
  
  <p>The code also works when copnnecting to the actual remote server.</p>
  
  <p>I am not sure where to go next.</p>