title: EOFException using HTTPUrlConnection from Android Mobile Application
body: <p>I have an Android Appliation and I'm getting EOFException while calling connection.getInputStream(). I'm calling this to consume a soap service provided by my local PHP server using Apache.</p>
  
  <pre><code>        // create url connection
          HttpURLConnection connection = (HttpURLConnection)new URL(getServerSoap()).openConnection();
          connection.setRequestProperty("Content-Type", "text/xml");
          connection.setRequestProperty("Content-Length", ""+content.getBytes().length);
          connection.setRequestMethod("POST");
          connection.setUseCaches(false);
          connection.setDoInput(true);
          connection.setDoOutput(true);
          OutputStream output = connection.getOutputStream();
          output.write(content.getBytes());
          output.flush();
          output.close();
          // EOFException here.
          InputStream input = connection.getInputStream();
  </code></pre>
  
  <p>I`ve checked similar answers on stackoverflow, regarding using:</p>
  
  <pre><code>connection.setRequestProperty("Connection", "close");
  </code></pre>
  
  <p>And</p>
  
  <pre><code>System.setProperty("http.keepAlive", "false");
  </code></pre>
  
  <p>But none of this worked for me. If I use the same code to call this servide on production mode on a Linux - CentOS 6, it works fine. Is there anything to do with my mac?</p>
  
  <p>How can I fix this issue? I`m running this code in development using:</p>
  
  <ol>
  <li>Mac OS X Yosemite</li>
  <li>Apache with MySQL on Mac</li>
  <li>Android Studio with SDK 22</li>
  </ol>