use of org.apache.commons.httpclient.HttpMethodRetryHandler in project zaproxy by zaproxy.
the class HttpSender method setMaxRetriesOnIOError.
/**
* Sets the maximum number of retries of an unsuccessful request caused by I/O errors.
* <p>
* The default number of retries is 3.
*
* @param retries the number of retries
* @throws IllegalArgumentException if {@code retries} is negative.
* @since 2.4.0
*/
public void setMaxRetriesOnIOError(int retries) {
if (retries < 0) {
throw new IllegalArgumentException("Parameter retries must be greater or equal to zero.");
}
HttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(retries, false);
client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
clientViaProxy.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
}
Aggregations