When we leave the scope of the try block in DatasetUtils.get, the
socket on the CloseableHttpResponse is automatically closed. This
happens before we consume the contents. This leads to some
conditions (not all) where reading the stream throws a socket closed
exception.
The fix is to use a more common pattern with the HttpClient by passing
a response handler to the client. This handler is executed in scope
thus bypassing this issue.
When we leave the scope of the try block in DatasetUtils.get, the socket on the CloseableHttpResponse is automatically closed. This happens before we consume the contents. This leads to some conditions (not all) where reading the stream throws a socket closed exception.
The fix is to use a more common pattern with the HttpClient by passing a response handler to the client. This handler is executed in scope thus bypassing this issue.