public T build() {
        final T context = createContext();
        context.setCookieSpecRegistry(cookieSpecRegistry);
        context.setAuthSchemeRegistry(authSchemeRegistry);
        context.setCookieStore(cookieStore);
        context.setCredentialsProvider(credentialsProvider);
        context.setAuthCache(authCache);
        if (authSchemeMap != null) {
            for (final Map.Entry<HttpHost, AuthScheme> entry : authSchemeMap.entrySet()) {
                context.resetAuthExchange(entry.getKey(), entry.getValue());
            }
        }
        return context;
    }
Abstract {@link HttpClientContext} builder.

@param <T> The HttpClientContext type or subtype.
@since 5.4
httpclient5/src/main/java/org/apache/hc/client5/http/AbstractClientContextBuilder.java