I could answer that late. But I also face the same problem. And I got permission from this. In my case, I closed the client before using HttpEntity. And after closing the client, I tried to download the file. The code below is similar to what I was doing:
HttpEntity httpEntity = null; try (final CloseableHttpClient client = createHttpClient()) { httpEntity = getEntity(client); } return downloadFile(httpEntity, targetDirectory, fileName);
After setting up my code to download the file before closing the client, now it works for me. The code below is similar to what I did now:
try (final CloseableHttpClient client = createHttpClient()) { HttpEntity httpEntity = getEntity(client); return downloadFile(httpEntity, targetDirectory, fileName); }
Nitin
source share