简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM