I have some code that I need to migrate from commons-httpclient 3.x to httpcomponents-client 4.x (or newer). In some error handling code, there are calls to setConnectionCloseForced(true)
on subclasses of HttpMethodBase
, such as GetMethod
or PostMethod
. What would be the equivalent in httpcomponents-client 4.x?
HttpMethodBase httpMethod = /* some value */;
try {
// do something
} catch (Exception e) {
// handle error
} finally {
// how to convert this?
httpMethod.setConnectionCloseForced(true);
}