Ever ran into a production issue with SocketTimeoutException or Socket Closed error? Well it can be daunting to
find that culprit. If you faced a similar situation while using HttpEntity, I have found a remedy.
Follow the snippet along.
The key point here to note is httpResponse.getEntity() returns HttpEntity which is hooked up with the same
So we have to consume the required repsonse content as EntityUtils.toString(httpResponse.getEntity()) before the HttpResponse is closed. Having failed to do that, the connection will reset and will throw Socket closed Error.