@Override
    public TimeValue getRetryInterval(
            final HttpResponse response,
            final int execCount,
            final HttpContext context) {
        Args.notNull(response, "response");

        final Header header = response.getFirstHeader(HttpHeaders.RETRY_AFTER);
        TimeValue retryAfter = null;
        if (header != null) {
            final String value = header.getValue();
            try {
                retryAfter = TimeValue.ofSeconds(Long.parseLong(value));
            } catch (final NumberFormatException ignore) {
                final Instant retryAfterDate = DateUtils.parseStandardDate(value);
                if (retryAfterDate != null) {
                    retryAfter =
                            TimeValue.ofMilliseconds(retryAfterDate.toEpochMilli() - System.currentTimeMillis());
                }
            }

            if (TimeValue.isPositive(retryAfter)) {
                return retryAfter;
            }
        }
        return this.defaultRetryInterval;
    }
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