When using HttpURLConnection does the InputStream need to be closed if we do not \'get\' and use it?
i.e. is this safe?
HttpURLConnection conn = (Htt
You also have to close error stream if the HTTP request fails (anything but 200):
try { ... } catch (IOException e) { connection.getErrorStream().close(); }
If you don't do it, all requests that don't return 200 (e.g. timeout) will leak one socket.