@Override
    public boolean retryRequest(
            final HttpRequest request,
            final IOException exception,
            final int execCount,
            final HttpContext context) {
        Args.notNull(request, "request");
        Args.notNull(exception, "exception");

        if (execCount > this.maxRetries) {
            // Do not retry if over max retries
            return false;
        }
        if (this.nonRetriableIOExceptionClasses.contains(exception.getClass())) {
            return false;
        }
        for (final Class<? extends IOException> rejectException : this.nonRetriableIOExceptionClasses) {
            if (rejectException.isInstance(exception)) {
                return false;
            }
        }
        if (request instanceof CancellableDependency && ((CancellableDependency) request).isCancelled()) {
            return false;
        }

        // Retry if the request is considered idempotent
        return handleAsIdempotent(request);
    }
Create the HTTP request retry strategy with a max retry count of 1,
default retry interval of 1 second, and using the following list of
non-retriable I/O exception classes:<br>
<ul>
<li>InterruptedIOException</li>
<li>UnknownHostException</li>
<li>ConnectException</li>
<li>ConnectionClosedException</li>
<li>SSLException</li>
</ul>

and retriable HTTP status codes:<br>
<ul>
<li>SC_TOO_MANY_REQUESTS (429)</li>
<li>SC_SERVICE_UNAVAILABLE (503)</li>
</ul>
httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java