ashish gupta
ashish gupta

Reputation: 140

How to close connection of org.apache.http.client.HttpClient object

I am not getting any method to close 'client' object. i am doing as part of fortify bug to close socket.

org.apache.http.client.HttpClient client = HttpClientBuilder.create().build();

Here, I have to close this but not able to find any close method.

Upvotes: 0

Views: 5661

Answers (1)

Faizan Burney
Faizan Burney

Reputation: 141

I think you should use HttpClients.createDefault(); method which returns a CloseableHttpClient object that can be closed manually. more info here : https://www.tutorialspoint.com/apache_httpclient/apache_httpclient_closing_connection.htm

Upvotes: 1

Related Questions