title: Server returned HTTP response code: 505 for URL
body: <p>I'm getting "Server returned HTTP response code: 505 for URL" for the below code:</p>
  
  <pre><code>                URL url = new URL(fileLocations.get(i));
                  URLConnection conn = url.openConnection();
                  InputStream in = conn.getInputStream();
  </code></pre>
  
  <p>While the URL works fine when opened in browser. Also tried encoding the url, that too didn't work.</p>
  
  <p>URL is : <a href="http://52.66.123.140:8080/TATADHPFILES/1239/TDH" rel="nofollow noreferrer">http://52.66.123.140:8080/TATADHPFILES/1239/TDH</a> Items/149387773752120170504_113201.jpg</p>
  
  <p>What may be the cause?</p>