You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/09/02 15:28:09 UTC

[09/17] httpcomponents-client git commit: Moved classes and renamed packages (no functional changes)

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClientBuilder.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClientBuilder.java
deleted file mode 100644
index 113d107..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClientBuilder.java
+++ /dev/null
@@ -1,1015 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.impl.sync;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.net.ProxySelector;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hc.client5.http.ConnectionKeepAliveStrategy;
-import org.apache.hc.client5.http.SchemePortResolver;
-import org.apache.hc.client5.http.SystemDefaultDnsResolver;
-import org.apache.hc.client5.http.auth.AuthSchemeProvider;
-import org.apache.hc.client5.http.auth.CredentialsProvider;
-import org.apache.hc.client5.http.config.AuthSchemes;
-import org.apache.hc.client5.http.config.RequestConfig;
-import org.apache.hc.client5.http.cookie.BasicCookieStore;
-import org.apache.hc.client5.http.cookie.CookieSpecProvider;
-import org.apache.hc.client5.http.cookie.CookieStore;
-import org.apache.hc.client5.http.entity.InputStreamFactory;
-import org.apache.hc.client5.http.impl.DefaultConnectionKeepAliveStrategy;
-import org.apache.hc.client5.http.impl.DefaultSchemePortResolver;
-import org.apache.hc.client5.http.impl.DefaultUserTokenHandler;
-import org.apache.hc.client5.http.impl.IdleConnectionEvictor;
-import org.apache.hc.client5.http.impl.NoopUserTokenHandler;
-import org.apache.hc.client5.http.impl.auth.BasicSchemeFactory;
-import org.apache.hc.client5.http.impl.auth.CredSspSchemeFactory;
-import org.apache.hc.client5.http.impl.auth.DigestSchemeFactory;
-import org.apache.hc.client5.http.impl.auth.KerberosSchemeFactory;
-import org.apache.hc.client5.http.impl.auth.NTLMSchemeFactory;
-import org.apache.hc.client5.http.impl.auth.SPNegoSchemeFactory;
-import org.apache.hc.client5.http.impl.auth.SystemDefaultCredentialsProvider;
-import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
-import org.apache.hc.client5.http.impl.protocol.DefaultAuthenticationStrategy;
-import org.apache.hc.client5.http.impl.protocol.DefaultRedirectStrategy;
-import org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner;
-import org.apache.hc.client5.http.impl.routing.DefaultRoutePlanner;
-import org.apache.hc.client5.http.impl.routing.SystemDefaultRoutePlanner;
-import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.protocol.AuthenticationStrategy;
-import org.apache.hc.client5.http.protocol.RedirectStrategy;
-import org.apache.hc.client5.http.protocol.RequestAddCookies;
-import org.apache.hc.client5.http.protocol.RequestAuthCache;
-import org.apache.hc.client5.http.protocol.RequestClientConnControl;
-import org.apache.hc.client5.http.protocol.RequestDefaultHeaders;
-import org.apache.hc.client5.http.protocol.RequestExpectContinue;
-import org.apache.hc.client5.http.protocol.ResponseProcessCookies;
-import org.apache.hc.client5.http.protocol.UserTokenHandler;
-import org.apache.hc.client5.http.routing.HttpRoutePlanner;
-import org.apache.hc.client5.http.sync.BackoffManager;
-import org.apache.hc.client5.http.sync.ConnectionBackoffStrategy;
-import org.apache.hc.client5.http.sync.ExecChainHandler;
-import org.apache.hc.client5.http.sync.HttpRequestRetryHandler;
-import org.apache.hc.client5.http.sync.ServiceUnavailableRetryStrategy;
-import org.apache.hc.core5.annotation.Internal;
-import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpRequestInterceptor;
-import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.HttpResponseInterceptor;
-import org.apache.hc.core5.http.config.Lookup;
-import org.apache.hc.core5.http.config.NamedElementChain;
-import org.apache.hc.core5.http.config.Registry;
-import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
-import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
-import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpProcessorBuilder;
-import org.apache.hc.core5.http.protocol.RequestContent;
-import org.apache.hc.core5.http.protocol.RequestTargetHost;
-import org.apache.hc.core5.http.protocol.RequestUserAgent;
-import org.apache.hc.core5.pool.ConnPoolControl;
-import org.apache.hc.core5.util.Args;
-import org.apache.hc.core5.util.TimeValue;
-import org.apache.hc.core5.util.VersionInfo;
-
-/**
- * Builder for {@link CloseableHttpClient} instances.
- * <p>
- * When a particular component is not explicitly set this class will
- * use its default implementation. System properties will be taken
- * into account when configuring the default implementations when
- * {@link #useSystemProperties()} method is called prior to calling
- * {@link #build()}.
- * </p>
- * <ul>
- *  <li>http.proxyHost</li>
- *  <li>http.proxyPort</li>
- *  <li>http.nonProxyHosts</li>
- *  <li>http.keepAlive</li>
- *  <li>http.agent</li>
- * </ul>
- * <p>
- * Please note that some settings used by this class can be mutually
- * exclusive and may not apply when building {@link CloseableHttpClient}
- * instances.
- * </p>
- *
- * @since 4.3
- */
-public class HttpClientBuilder {
-
-    private static class RequestInterceptorEntry {
-
-        enum Postion { FIRST, LAST }
-
-        final Postion postion;
-        final HttpRequestInterceptor interceptor;
-
-        private RequestInterceptorEntry(final Postion postion, final HttpRequestInterceptor interceptor) {
-            this.postion = postion;
-            this.interceptor = interceptor;
-        }
-    }
-
-    private static class ResponseInterceptorEntry {
-
-        enum Postion { FIRST, LAST }
-
-        final Postion postion;
-        final HttpResponseInterceptor interceptor;
-
-        private ResponseInterceptorEntry(final Postion postion, final HttpResponseInterceptor interceptor) {
-            this.postion = postion;
-            this.interceptor = interceptor;
-        }
-    }
-
-    private static class ExecInterceptorEntry {
-
-        enum Postion { BEFORE, AFTER, REPLACE, FIRST, LAST }
-
-        final Postion postion;
-        final String name;
-        final ExecChainHandler interceptor;
-        final String existing;
-
-        private ExecInterceptorEntry(
-                final Postion postion,
-                final String name,
-                final ExecChainHandler interceptor,
-                final String existing) {
-            this.postion = postion;
-            this.name = name;
-            this.interceptor = interceptor;
-            this.existing = existing;
-        }
-
-    }
-
-    private HttpRequestExecutor requestExec;
-    private HttpClientConnectionManager connManager;
-    private boolean connManagerShared;
-    private SchemePortResolver schemePortResolver;
-    private ConnectionReuseStrategy reuseStrategy;
-    private ConnectionKeepAliveStrategy keepAliveStrategy;
-    private AuthenticationStrategy targetAuthStrategy;
-    private AuthenticationStrategy proxyAuthStrategy;
-    private UserTokenHandler userTokenHandler;
-
-    private LinkedList<RequestInterceptorEntry> requestInterceptors;
-    private LinkedList<ResponseInterceptorEntry> responseInterceptors;
-    private LinkedList<ExecInterceptorEntry> execInterceptors;
-
-    private HttpRequestRetryHandler retryHandler;
-    private HttpRoutePlanner routePlanner;
-    private RedirectStrategy redirectStrategy;
-    private ConnectionBackoffStrategy connectionBackoffStrategy;
-    private BackoffManager backoffManager;
-    private ServiceUnavailableRetryStrategy serviceUnavailStrategy;
-    private Lookup<AuthSchemeProvider> authSchemeRegistry;
-    private Lookup<CookieSpecProvider> cookieSpecRegistry;
-    private LinkedHashMap<String, InputStreamFactory> contentDecoderMap;
-    private CookieStore cookieStore;
-    private CredentialsProvider credentialsProvider;
-    private String userAgent;
-    private HttpHost proxy;
-    private Collection<? extends Header> defaultHeaders;
-    private RequestConfig defaultRequestConfig;
-    private boolean evictExpiredConnections;
-    private boolean evictIdleConnections;
-    private TimeValue maxIdleTime;
-
-    private boolean systemProperties;
-    private boolean redirectHandlingDisabled;
-    private boolean automaticRetriesDisabled;
-    private boolean contentCompressionDisabled;
-    private boolean cookieManagementDisabled;
-    private boolean authCachingDisabled;
-    private boolean connectionStateDisabled;
-
-    private List<Closeable> closeables;
-
-    public static HttpClientBuilder create() {
-        return new HttpClientBuilder();
-    }
-
-    protected HttpClientBuilder() {
-        super();
-    }
-
-    /**
-     * Assigns {@link HttpRequestExecutor} instance.
-     */
-    public final HttpClientBuilder setRequestExecutor(final HttpRequestExecutor requestExec) {
-        this.requestExec = requestExec;
-        return this;
-    }
-
-    /**
-     * Assigns {@link HttpClientConnectionManager} instance.
-     */
-    public final HttpClientBuilder setConnectionManager(
-            final HttpClientConnectionManager connManager) {
-        this.connManager = connManager;
-        return this;
-    }
-
-    /**
-     * Defines the connection manager is to be shared by multiple
-     * client instances.
-     * <p>
-     * If the connection manager is shared its life-cycle is expected
-     * to be managed by the caller and it will not be shut down
-     * if the client is closed.
-     * </p>
-     *
-     * @param shared defines whether or not the connection manager can be shared
-     *  by multiple clients.
-     *
-     * @since 4.4
-     */
-    public final HttpClientBuilder setConnectionManagerShared(
-            final boolean shared) {
-        this.connManagerShared = shared;
-        return this;
-    }
-
-    /**
-     * Assigns {@link ConnectionReuseStrategy} instance.
-     */
-    public final HttpClientBuilder setConnectionReuseStrategy(
-            final ConnectionReuseStrategy reuseStrategy) {
-        this.reuseStrategy = reuseStrategy;
-        return this;
-    }
-
-    /**
-     * Assigns {@link ConnectionKeepAliveStrategy} instance.
-     */
-    public final HttpClientBuilder setKeepAliveStrategy(
-            final ConnectionKeepAliveStrategy keepAliveStrategy) {
-        this.keepAliveStrategy = keepAliveStrategy;
-        return this;
-    }
-
-    /**
-     * Assigns {@link AuthenticationStrategy} instance for target
-     * host authentication.
-     */
-    public final HttpClientBuilder setTargetAuthenticationStrategy(
-            final AuthenticationStrategy targetAuthStrategy) {
-        this.targetAuthStrategy = targetAuthStrategy;
-        return this;
-    }
-
-    /**
-     * Assigns {@link AuthenticationStrategy} instance for proxy
-     * authentication.
-     */
-    public final HttpClientBuilder setProxyAuthenticationStrategy(
-            final AuthenticationStrategy proxyAuthStrategy) {
-        this.proxyAuthStrategy = proxyAuthStrategy;
-        return this;
-    }
-
-    /**
-     * Assigns {@link UserTokenHandler} instance.
-     * <p>
-     * Please note this value can be overridden by the {@link #disableConnectionState()}
-     * method.
-     * </p>
-     */
-    public final HttpClientBuilder setUserTokenHandler(final UserTokenHandler userTokenHandler) {
-        this.userTokenHandler = userTokenHandler;
-        return this;
-    }
-
-    /**
-     * Disables connection state tracking.
-     */
-    public final HttpClientBuilder disableConnectionState() {
-        connectionStateDisabled = true;
-        return this;
-    }
-
-    /**
-     * Assigns {@link SchemePortResolver} instance.
-     */
-    public final HttpClientBuilder setSchemePortResolver(
-            final SchemePortResolver schemePortResolver) {
-        this.schemePortResolver = schemePortResolver;
-        return this;
-    }
-
-    /**
-     * Assigns {@code User-Agent} value.
-     */
-    public final HttpClientBuilder setUserAgent(final String userAgent) {
-        this.userAgent = userAgent;
-        return this;
-    }
-
-    /**
-     * Assigns default request header values.
-     */
-    public final HttpClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
-        this.defaultHeaders = defaultHeaders;
-        return this;
-    }
-
-    /**
-     * Adds this protocol interceptor to the head of the protocol processing list.
-     */
-    public final HttpClientBuilder addRequestInterceptorFirst(final HttpResponseInterceptor interceptor) {
-        Args.notNull(interceptor, "Interceptor");
-        if (responseInterceptors == null) {
-            responseInterceptors = new LinkedList<>();
-        }
-        responseInterceptors.add(new ResponseInterceptorEntry(ResponseInterceptorEntry.Postion.FIRST, interceptor));
-        return this;
-    }
-
-    /**
-     * Adds this protocol interceptor to the tail of the protocol processing list.
-     */
-    public final HttpClientBuilder addResponseInterceptorLast(final HttpResponseInterceptor interceptor) {
-        Args.notNull(interceptor, "Interceptor");
-        if (responseInterceptors == null) {
-            responseInterceptors = new LinkedList<>();
-        }
-        responseInterceptors.add(new ResponseInterceptorEntry(ResponseInterceptorEntry.Postion.LAST, interceptor));
-        return this;
-    }
-
-    /**
-     * Adds this protocol interceptor to the head of the protocol processing list.
-     */
-    public final HttpClientBuilder addRequestInterceptorFirst(final HttpRequestInterceptor interceptor) {
-        Args.notNull(interceptor, "Interceptor");
-        if (requestInterceptors == null) {
-            requestInterceptors = new LinkedList<>();
-        }
-        requestInterceptors.add(new RequestInterceptorEntry(RequestInterceptorEntry.Postion.FIRST, interceptor));
-        return this;
-    }
-
-    /**
-     * Adds this protocol interceptor to the tail of the protocol processing list.
-     */
-    public final HttpClientBuilder addResponseInterceptorLast(final HttpRequestInterceptor interceptor) {
-        Args.notNull(interceptor, "Interceptor");
-        if (requestInterceptors == null) {
-            requestInterceptors = new LinkedList<>();
-        }
-        requestInterceptors.add(new RequestInterceptorEntry(RequestInterceptorEntry.Postion.LAST, interceptor));
-        return this;
-    }
-
-    /**
-     * Adds this execution interceptor before an existing interceptor.
-     */
-    public final HttpClientBuilder addExecInterceptorBefore(final String existing, final String name, final ExecChainHandler interceptor) {
-        Args.notBlank(existing, "Existing");
-        Args.notBlank(name, "Name");
-        Args.notNull(interceptor, "Interceptor");
-        if (execInterceptors == null) {
-            execInterceptors = new LinkedList<>();
-        }
-        execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.BEFORE, name, interceptor, existing));
-        return this;
-    }
-
-    /**
-     * Adds this execution interceptor after interceptor with the given name.
-     */
-    public final HttpClientBuilder addExecInterceptorAfter(final String existing, final String name, final ExecChainHandler interceptor) {
-        Args.notBlank(existing, "Existing");
-        Args.notBlank(name, "Name");
-        Args.notNull(interceptor, "Interceptor");
-        if (execInterceptors == null) {
-            execInterceptors = new LinkedList<>();
-        }
-        execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.AFTER, name, interceptor, existing));
-        return this;
-    }
-
-    /**
-     * Replace an existing interceptor with the given name with new interceptor.
-     */
-    public final HttpClientBuilder replaceExecInterceptor(final String existing, final ExecChainHandler interceptor) {
-        Args.notBlank(existing, "Existing");
-        Args.notNull(interceptor, "Interceptor");
-        if (execInterceptors == null) {
-            execInterceptors = new LinkedList<>();
-        }
-        execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.REPLACE, existing, interceptor, existing));
-        return this;
-    }
-
-    /**
-     * Add an interceptor to the head of the processing list.
-     */
-    public final HttpClientBuilder addExecInterceptorFirst(final String name, final ExecChainHandler interceptor) {
-        Args.notNull(name, "Name");
-        Args.notNull(interceptor, "Interceptor");
-        execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.FIRST, name, interceptor, null));
-        return this;
-    }
-
-    /**
-     * Add an interceptor to the tail of the processing list.
-     */
-    public final HttpClientBuilder addExecInterceptorLast(final String name, final ExecChainHandler interceptor) {
-        Args.notNull(name, "Name");
-        Args.notNull(interceptor, "Interceptor");
-        execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.LAST, name, interceptor, null));
-        return this;
-    }
-
-    /**
-     * Disables state (cookie) management.
-     */
-    public final HttpClientBuilder disableCookieManagement() {
-        this.cookieManagementDisabled = true;
-        return this;
-    }
-
-    /**
-     * Disables automatic content decompression.
-     */
-    public final HttpClientBuilder disableContentCompression() {
-        contentCompressionDisabled = true;
-        return this;
-    }
-
-    /**
-     * Disables authentication scheme caching.
-     */
-    public final HttpClientBuilder disableAuthCaching() {
-        this.authCachingDisabled = true;
-        return this;
-    }
-
-    /**
-     * Assigns {@link HttpRequestRetryHandler} instance.
-     * <p>
-     * Please note this value can be overridden by the {@link #disableAutomaticRetries()}
-     * method.
-     */
-    public final HttpClientBuilder setRetryHandler(final HttpRequestRetryHandler retryHandler) {
-        this.retryHandler = retryHandler;
-        return this;
-    }
-
-    /**
-     * Disables automatic request recovery and re-execution.
-     */
-    public final HttpClientBuilder disableAutomaticRetries() {
-        automaticRetriesDisabled = true;
-        return this;
-    }
-
-    /**
-     * Assigns default proxy value.
-     * <p>
-     * Please note this value can be overridden by the {@link #setRoutePlanner(
-     *   org.apache.hc.client5.http.routing.HttpRoutePlanner)} method.
-     */
-    public final HttpClientBuilder setProxy(final HttpHost proxy) {
-        this.proxy = proxy;
-        return this;
-    }
-
-    /**
-     * Assigns {@link HttpRoutePlanner} instance.
-     */
-    public final HttpClientBuilder setRoutePlanner(final HttpRoutePlanner routePlanner) {
-        this.routePlanner = routePlanner;
-        return this;
-    }
-
-    /**
-     * Assigns {@link RedirectStrategy} instance.
-     * <p>
-     * Please note this value can be overridden by the {@link #disableRedirectHandling()}
-     * method.
-     * </p>
-`     */
-    public final HttpClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
-        this.redirectStrategy = redirectStrategy;
-        return this;
-    }
-
-    /**
-     * Disables automatic redirect handling.
-     */
-    public final HttpClientBuilder disableRedirectHandling() {
-        redirectHandlingDisabled = true;
-        return this;
-    }
-
-    /**
-     * Assigns {@link ConnectionBackoffStrategy} instance.
-     */
-    public final HttpClientBuilder setConnectionBackoffStrategy(
-            final ConnectionBackoffStrategy connectionBackoffStrategy) {
-        this.connectionBackoffStrategy = connectionBackoffStrategy;
-        return this;
-    }
-
-    /**
-     * Assigns {@link BackoffManager} instance.
-     */
-    public final HttpClientBuilder setBackoffManager(final BackoffManager backoffManager) {
-        this.backoffManager = backoffManager;
-        return this;
-    }
-
-    /**
-     * Assigns {@link ServiceUnavailableRetryStrategy} instance.
-     */
-    public final HttpClientBuilder setServiceUnavailableRetryStrategy(
-            final ServiceUnavailableRetryStrategy serviceUnavailStrategy) {
-        this.serviceUnavailStrategy = serviceUnavailStrategy;
-        return this;
-    }
-
-    /**
-     * Assigns default {@link CookieStore} instance which will be used for
-     * request execution if not explicitly set in the client execution context.
-     */
-    public final HttpClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
-        this.cookieStore = cookieStore;
-        return this;
-    }
-
-    /**
-     * Assigns default {@link CredentialsProvider} instance which will be used
-     * for request execution if not explicitly set in the client execution
-     * context.
-     */
-    public final HttpClientBuilder setDefaultCredentialsProvider(
-            final CredentialsProvider credentialsProvider) {
-        this.credentialsProvider = credentialsProvider;
-        return this;
-    }
-
-    /**
-     * Assigns default {@link org.apache.hc.client5.http.auth.AuthScheme} registry which will
-     * be used for request execution if not explicitly set in the client execution
-     * context.
-     */
-    public final HttpClientBuilder setDefaultAuthSchemeRegistry(
-            final Lookup<AuthSchemeProvider> authSchemeRegistry) {
-        this.authSchemeRegistry = authSchemeRegistry;
-        return this;
-    }
-
-    /**
-     * Assigns default {@link org.apache.hc.client5.http.cookie.CookieSpec} registry which will
-     * be used for request execution if not explicitly set in the client execution
-     * context.
-     *
-     * @see CookieSpecRegistries
-     *
-     */
-    public final HttpClientBuilder setDefaultCookieSpecRegistry(
-            final Lookup<CookieSpecProvider> cookieSpecRegistry) {
-        this.cookieSpecRegistry = cookieSpecRegistry;
-        return this;
-    }
-
-
-    /**
-     * Assigns a map of {@link org.apache.hc.client5.http.entity.InputStreamFactory}s
-     * to be used for automatic content decompression.
-     */
-    public final HttpClientBuilder setContentDecoderRegistry(
-            final LinkedHashMap<String, InputStreamFactory> contentDecoderMap) {
-        this.contentDecoderMap = contentDecoderMap;
-        return this;
-    }
-
-    /**
-     * Assigns default {@link RequestConfig} instance which will be used
-     * for request execution if not explicitly set in the client execution
-     * context.
-     */
-    public final HttpClientBuilder setDefaultRequestConfig(final RequestConfig config) {
-        this.defaultRequestConfig = config;
-        return this;
-    }
-
-    /**
-     * Use system properties when creating and configuring default
-     * implementations.
-     */
-    public final HttpClientBuilder useSystemProperties() {
-        this.systemProperties = true;
-        return this;
-    }
-
-    /**
-     * Makes this instance of HttpClient proactively evict expired connections from the
-     * connection pool using a background thread.
-     * <p>
-     * One MUST explicitly close HttpClient with {@link CloseableHttpClient#close()} in order
-     * to stop and release the background thread.
-     * <p>
-     * Please note this method has no effect if the instance of HttpClient is configured to
-     * use a shared connection manager.
-     *
-     * @see #setConnectionManagerShared(boolean)
-     * @see ConnPoolControl#closeExpired()
-     *
-     * @since 4.4
-     */
-    public final HttpClientBuilder evictExpiredConnections() {
-        evictExpiredConnections = true;
-        return this;
-    }
-
-    /**
-     * Makes this instance of HttpClient proactively evict idle connections from the
-     * connection pool using a background thread.
-     * <p>
-     * One MUST explicitly close HttpClient with {@link CloseableHttpClient#close()} in order
-     * to stop and release the background thread.
-     * <p>
-     * Please note this method has no effect if the instance of HttpClient is configured to
-     * use a shared connection manager.
-     *
-     * @see #setConnectionManagerShared(boolean)
-     * @see ConnPoolControl#closeIdle(TimeValue)
-     *
-     * @param maxIdleTime maximum time persistent connections can stay idle while kept alive
-     * in the connection pool. Connections whose inactivity period exceeds this value will
-     * get closed and evicted from the pool.
-     *
-     * @since 4.4
-     */
-    public final HttpClientBuilder evictIdleConnections(final TimeValue maxIdleTime) {
-        this.evictIdleConnections = true;
-        this.maxIdleTime = maxIdleTime;
-        return this;
-    }
-
-    /**
-     * Request exec chain customization and extension.
-     * <p>
-     * For internal use.
-     */
-    @Internal
-    protected void customizeExecChain(final NamedElementChain<ExecChainHandler> execChainDefinition) {
-    }
-
-    /**
-     * Adds to the list of {@link Closeable} resources to be managed by the client.
-     * <p>
-     * For internal use.
-     */
-    @Internal
-    protected void addCloseable(final Closeable closeable) {
-        if (closeable == null) {
-            return;
-        }
-        if (closeables == null) {
-            closeables = new ArrayList<>();
-        }
-        closeables.add(closeable);
-    }
-
-    public CloseableHttpClient build() {
-        // Create main request executor
-        // We copy the instance fields to avoid changing them, and rename to avoid accidental use of the wrong version
-        HttpRequestExecutor requestExecCopy = this.requestExec;
-        if (requestExecCopy == null) {
-            requestExecCopy = new HttpRequestExecutor();
-        }
-        HttpClientConnectionManager connManagerCopy = this.connManager;
-        if (connManagerCopy == null) {
-            connManagerCopy = PoolingHttpClientConnectionManagerBuilder.create().build();
-        }
-        ConnectionReuseStrategy reuseStrategyCopy = this.reuseStrategy;
-        if (reuseStrategyCopy == null) {
-            if (systemProperties) {
-                final String s = System.getProperty("http.keepAlive", "true");
-                if ("true".equalsIgnoreCase(s)) {
-                    reuseStrategyCopy = DefaultConnectionReuseStrategy.INSTANCE;
-                } else {
-                    reuseStrategyCopy = new ConnectionReuseStrategy() {
-                        @Override
-                        public boolean keepAlive(
-                                final HttpRequest request, final HttpResponse response, final HttpContext context) {
-                            return false;
-                        }
-                    };
-                }
-            } else {
-                reuseStrategyCopy = DefaultConnectionReuseStrategy.INSTANCE;
-            }
-        }
-
-        ConnectionKeepAliveStrategy keepAliveStrategyCopy = this.keepAliveStrategy;
-        if (keepAliveStrategyCopy == null) {
-            keepAliveStrategyCopy = DefaultConnectionKeepAliveStrategy.INSTANCE;
-        }
-        AuthenticationStrategy targetAuthStrategyCopy = this.targetAuthStrategy;
-        if (targetAuthStrategyCopy == null) {
-            targetAuthStrategyCopy = DefaultAuthenticationStrategy.INSTANCE;
-        }
-        AuthenticationStrategy proxyAuthStrategyCopy = this.proxyAuthStrategy;
-        if (proxyAuthStrategyCopy == null) {
-            proxyAuthStrategyCopy = DefaultAuthenticationStrategy.INSTANCE;
-        }
-        UserTokenHandler userTokenHandlerCopy = this.userTokenHandler;
-        if (userTokenHandlerCopy == null) {
-            if (!connectionStateDisabled) {
-                userTokenHandlerCopy = DefaultUserTokenHandler.INSTANCE;
-            } else {
-                userTokenHandlerCopy = NoopUserTokenHandler.INSTANCE;
-            }
-        }
-
-        String userAgentCopy = this.userAgent;
-        if (userAgentCopy == null) {
-            if (systemProperties) {
-                userAgentCopy = System.getProperty("http.agent");
-            }
-            if (userAgentCopy == null) {
-                userAgentCopy = VersionInfo.getSoftwareInfo("Apache-HttpClient",
-                        "org.apache.hc.client5", getClass());
-            }
-        }
-
-        final NamedElementChain<ExecChainHandler> execChainDefinition = new NamedElementChain<>();
-        execChainDefinition.addLast(
-                new MainClientExec(reuseStrategyCopy, keepAliveStrategyCopy, userTokenHandlerCopy),
-                ChainElements.MAIN_TRANSPORT.name());
-        execChainDefinition.addFirst(
-                new ConnectExec(
-                        reuseStrategyCopy,
-                        new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
-                        proxyAuthStrategyCopy),
-                ChainElements.CONNECT.name());
-
-        final HttpProcessorBuilder b = HttpProcessorBuilder.create();
-        if (requestInterceptors != null) {
-            for (final RequestInterceptorEntry entry: requestInterceptors) {
-                if (entry.postion == RequestInterceptorEntry.Postion.FIRST) {
-                    b.addFirst(entry.interceptor);
-                }
-            }
-        }
-        if (responseInterceptors != null) {
-            for (final ResponseInterceptorEntry entry: responseInterceptors) {
-                if (entry.postion == ResponseInterceptorEntry.Postion.FIRST) {
-                    b.addFirst(entry.interceptor);
-                }
-            }
-        }
-        b.addAll(
-                new RequestDefaultHeaders(defaultHeaders),
-                new RequestContent(),
-                new RequestTargetHost(),
-                new RequestClientConnControl(),
-                new RequestUserAgent(userAgentCopy),
-                new RequestExpectContinue());
-        if (!cookieManagementDisabled) {
-            b.add(new RequestAddCookies());
-        }
-        if (!authCachingDisabled) {
-            b.add(new RequestAuthCache());
-        }
-        if (!cookieManagementDisabled) {
-            b.add(new ResponseProcessCookies());
-        }
-        if (requestInterceptors != null) {
-            for (final RequestInterceptorEntry entry: requestInterceptors) {
-                if (entry.postion == RequestInterceptorEntry.Postion.LAST) {
-                    b.addFirst(entry.interceptor);
-                }
-            }
-        }
-        if (responseInterceptors != null) {
-            for (final ResponseInterceptorEntry entry: responseInterceptors) {
-                if (entry.postion == ResponseInterceptorEntry.Postion.LAST) {
-                    b.addFirst(entry.interceptor);
-                }
-            }
-        }
-        final HttpProcessor httpProcessor = b.build();
-        execChainDefinition.addFirst(
-                new ProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
-                ChainElements.PROTOCOL.name());
-
-        // Add request retry executor, if not disabled
-        if (!automaticRetriesDisabled) {
-            HttpRequestRetryHandler retryHandlerCopy = this.retryHandler;
-            if (retryHandlerCopy == null) {
-                retryHandlerCopy = DefaultHttpRequestRetryHandler.INSTANCE;
-            }
-            execChainDefinition.addFirst(
-                    new RetryExec(retryHandlerCopy),
-                    ChainElements.RETRY_IO_ERROR.name());
-        }
-
-        HttpRoutePlanner routePlannerCopy = this.routePlanner;
-        if (routePlannerCopy == null) {
-            SchemePortResolver schemePortResolverCopy = this.schemePortResolver;
-            if (schemePortResolverCopy == null) {
-                schemePortResolverCopy = DefaultSchemePortResolver.INSTANCE;
-            }
-            if (proxy != null) {
-                routePlannerCopy = new DefaultProxyRoutePlanner(proxy, schemePortResolverCopy);
-            } else if (systemProperties) {
-                routePlannerCopy = new SystemDefaultRoutePlanner(
-                        schemePortResolverCopy, ProxySelector.getDefault());
-            } else {
-                routePlannerCopy = new DefaultRoutePlanner(schemePortResolverCopy);
-            }
-        }
-
-        // Optionally, add service unavailable retry executor
-        final ServiceUnavailableRetryStrategy serviceUnavailStrategyCopy = this.serviceUnavailStrategy;
-        if (serviceUnavailStrategyCopy != null) {
-            execChainDefinition.addFirst(
-                    new ServiceUnavailableRetryExec(serviceUnavailStrategyCopy),
-                    ChainElements.RETRY_SERVICE_UNAVAILABLE.name());
-        }
-
-        // Add redirect executor, if not disabled
-        if (!redirectHandlingDisabled) {
-            RedirectStrategy redirectStrategyCopy = this.redirectStrategy;
-            if (redirectStrategyCopy == null) {
-                redirectStrategyCopy = DefaultRedirectStrategy.INSTANCE;
-            }
-            execChainDefinition.addFirst(
-                    new RedirectExec(routePlannerCopy, redirectStrategyCopy),
-                    ChainElements.REDIRECT.name());
-        }
-
-        if (!contentCompressionDisabled) {
-            if (contentDecoderMap != null) {
-                final List<String> encodings = new ArrayList<>(contentDecoderMap.keySet());
-                final RegistryBuilder<InputStreamFactory> b2 = RegistryBuilder.create();
-                for (final Map.Entry<String, InputStreamFactory> entry: contentDecoderMap.entrySet()) {
-                    b2.register(entry.getKey(), entry.getValue());
-                }
-                final Registry<InputStreamFactory> decoderRegistry = b2.build();
-                execChainDefinition.addFirst(
-                        new ContentCompressionExec(encodings, decoderRegistry, true),
-                        ChainElements.REDIRECT.name());
-            } else {
-                execChainDefinition.addFirst(
-                        new ContentCompressionExec(true),
-                        ChainElements.REDIRECT.name());
-            }
-        }
-
-        // Optionally, add connection back-off executor
-        if (this.backoffManager != null && this.connectionBackoffStrategy != null) {
-            execChainDefinition.addFirst(new BackoffStrategyExec(this.connectionBackoffStrategy, this.backoffManager),
-                    ChainElements.BACK_OFF.name());
-        }
-
-        if (execInterceptors != null) {
-            for (final ExecInterceptorEntry entry: execInterceptors) {
-                switch (entry.postion) {
-                    case AFTER:
-                        execChainDefinition.addAfter(entry.existing, entry.interceptor, entry.name);
-                        break;
-                    case BEFORE:
-                        execChainDefinition.addBefore(entry.existing, entry.interceptor, entry.name);
-                        break;
-                    case REPLACE:
-                        execChainDefinition.replace(entry.existing, entry.interceptor);
-                        break;
-                    case FIRST:
-                        execChainDefinition.addFirst(entry.interceptor, entry.name);
-                        break;
-                    case LAST:
-                        execChainDefinition.addLast(entry.interceptor, entry.name);
-                        break;
-                }
-            }
-        }
-
-        customizeExecChain(execChainDefinition);
-
-        NamedElementChain<ExecChainHandler>.Node current = execChainDefinition.getLast();
-        ExecChainElement execChain = null;
-        while (current != null) {
-            execChain = new ExecChainElement(current.getValue(), execChain);
-            current = current.getPrevious();
-        }
-
-        Lookup<AuthSchemeProvider> authSchemeRegistryCopy = this.authSchemeRegistry;
-        if (authSchemeRegistryCopy == null) {
-            authSchemeRegistryCopy = RegistryBuilder.<AuthSchemeProvider>create()
-                .register(AuthSchemes.BASIC, new BasicSchemeFactory())
-                .register(AuthSchemes.DIGEST, new DigestSchemeFactory())
-                .register(AuthSchemes.CREDSSP, new CredSspSchemeFactory())
-                .register(AuthSchemes.NTLM, new NTLMSchemeFactory())
-                .register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory(SystemDefaultDnsResolver.INSTANCE, true, true))
-                .register(AuthSchemes.KERBEROS, new KerberosSchemeFactory(SystemDefaultDnsResolver.INSTANCE, true, true))
-                .build();
-        }
-        Lookup<CookieSpecProvider> cookieSpecRegistryCopy = this.cookieSpecRegistry;
-        if (cookieSpecRegistryCopy == null) {
-            cookieSpecRegistryCopy = CookieSpecRegistries.createDefault();
-        }
-
-        CookieStore defaultCookieStore = this.cookieStore;
-        if (defaultCookieStore == null) {
-            defaultCookieStore = new BasicCookieStore();
-        }
-
-        CredentialsProvider defaultCredentialsProvider = this.credentialsProvider;
-        if (defaultCredentialsProvider == null) {
-            if (systemProperties) {
-                defaultCredentialsProvider = new SystemDefaultCredentialsProvider();
-            } else {
-                defaultCredentialsProvider = new BasicCredentialsProvider();
-            }
-        }
-
-        List<Closeable> closeablesCopy = closeables != null ? new ArrayList<>(closeables) : null;
-        if (!this.connManagerShared) {
-            if (closeablesCopy == null) {
-                closeablesCopy = new ArrayList<>(1);
-            }
-            if (evictExpiredConnections || evictIdleConnections) {
-                if (connManagerCopy instanceof ConnPoolControl) {
-                    final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvictor((ConnPoolControl<?>) connManagerCopy,
-                            maxIdleTime, maxIdleTime);
-                    closeablesCopy.add(new Closeable() {
-
-                        @Override
-                        public void close() throws IOException {
-                            connectionEvictor.shutdown();
-                            try {
-                                connectionEvictor.awaitTermination(1L, TimeUnit.SECONDS);
-                            } catch (final InterruptedException interrupted) {
-                                Thread.currentThread().interrupt();
-                            }
-                        }
-
-                    });
-                    connectionEvictor.start();
-                }
-            }
-            closeablesCopy.add(connManagerCopy);
-        }
-
-        return new InternalHttpClient(
-                connManagerCopy,
-                requestExecCopy,
-                execChain,
-                routePlannerCopy,
-                cookieSpecRegistryCopy,
-                authSchemeRegistryCopy,
-                defaultCookieStore,
-                defaultCredentialsProvider,
-                defaultRequestConfig != null ? defaultRequestConfig : RequestConfig.DEFAULT,
-                closeablesCopy);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClients.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClients.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClients.java
deleted file mode 100644
index bb2323e..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpClients.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.impl.sync;
-
-import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
-import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-
-/**
- * Factory methods for {@link CloseableHttpClient} instances.
- * @since 4.3
- */
-public class HttpClients {
-
-    private HttpClients() {
-        super();
-    }
-
-    /**
-     * Creates builder object for construction of custom
-     * {@link CloseableHttpClient} instances.
-     */
-    public static HttpClientBuilder custom() {
-        return HttpClientBuilder.create();
-    }
-
-    /**
-     * Creates {@link CloseableHttpClient} instance with default
-     * configuration.
-     */
-    public static CloseableHttpClient createDefault() {
-        return HttpClientBuilder.create().build();
-    }
-
-    /**
-     * Creates {@link CloseableHttpClient} instance with default
-     * configuration based on ssytem properties.
-     */
-    public static CloseableHttpClient createSystem() {
-        return HttpClientBuilder.create().useSystemProperties().build();
-    }
-
-    /**
-     * Creates {@link CloseableHttpClient} instance that implements
-     * the most basic HTTP protocol support.
-     */
-    public static MinimalHttpClient createMinimal() {
-        return new MinimalHttpClient(new PoolingHttpClientConnectionManager());
-    }
-
-    /**
-     * Creates {@link CloseableHttpClient} instance that implements
-     * the most basic HTTP protocol support.
-     */
-    public static MinimalHttpClient createMinimal(final HttpClientConnectionManager connManager) {
-        return new MinimalHttpClient(connManager);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestFutureTask.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestFutureTask.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestFutureTask.java
deleted file mode 100644
index b4e9b62..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestFutureTask.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.client5.http.impl.sync;
-
-import java.util.concurrent.FutureTask;
-
-import org.apache.hc.core5.concurrent.Cancellable;
-import org.apache.hc.core5.http.ClassicHttpRequest;
-
-/**
- * FutureTask implementation that wraps a HttpAsyncClientCallable and exposes various task
- * specific metrics.
- *
- * @param <V>
- */
-public class HttpRequestFutureTask<V> extends FutureTask<V> {
-
-    private final ClassicHttpRequest request;
-    private final HttpRequestTaskCallable<V> callable;
-
-    public HttpRequestFutureTask(
-            final ClassicHttpRequest request,
-            final HttpRequestTaskCallable<V> httpCallable) {
-        super(httpCallable);
-        this.request = request;
-        this.callable = httpCallable;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see java.util.concurrent.FutureTask#cancel(boolean)
-     */
-    @Override
-    public boolean cancel(final boolean mayInterruptIfRunning) {
-        callable.cancel();
-        if (mayInterruptIfRunning && request instanceof Cancellable) {
-            ((Cancellable) request).cancel();
-        }
-        return super.cancel(mayInterruptIfRunning);
-    }
-
-    /**
-     * @return the time in millis the task was scheduled.
-     */
-    public long scheduledTime() {
-        return callable.getScheduled();
-    }
-
-    /**
-     * @return the time in millis the task was started.
-     */
-    public long startedTime() {
-        return callable.getStarted();
-    }
-
-    /**
-     * @return the time in millis the task was finished/cancelled.
-     */
-    public long endedTime() {
-        if (isDone()) {
-            return callable.getEnded();
-        } else {
-            throw new IllegalStateException("Task is not done yet");
-        }
-    }
-
-    /**
-     * @return the time in millis it took to make the request (excluding the time it was
-     * scheduled to be executed).
-     */
-    public long requestDuration() {
-        if (isDone()) {
-            return endedTime() - startedTime();
-        } else {
-            throw new IllegalStateException("Task is not done yet");
-        }
-    }
-
-    /**
-     * @return the time in millis it took to execute the task from the moment it was scheduled.
-     */
-    public long taskDuration() {
-        if (isDone()) {
-            return endedTime() - scheduledTime();
-        } else {
-            throw new IllegalStateException("Task is not done yet");
-        }
-    }
-
-    @Override
-    public String toString() {
-        return request.toString();
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestTaskCallable.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestTaskCallable.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestTaskCallable.java
deleted file mode 100644
index ac7696b..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/HttpRequestTaskCallable.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.client5.http.impl.sync;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.hc.client5.http.sync.HttpClient;
-import org.apache.hc.core5.concurrent.FutureCallback;
-import org.apache.hc.core5.http.ClassicHttpRequest;
-import org.apache.hc.core5.http.io.HttpClientResponseHandler;
-import org.apache.hc.core5.http.protocol.HttpContext;
-
-class HttpRequestTaskCallable<V> implements Callable<V> {
-
-    private final ClassicHttpRequest request;
-    private final HttpClient httpclient;
-    private final AtomicBoolean cancelled = new AtomicBoolean(false);
-
-    private final long scheduled = System.currentTimeMillis();
-    private long started = -1;
-    private long ended = -1;
-
-    private final HttpContext context;
-    private final HttpClientResponseHandler<V> responseHandler;
-    private final FutureCallback<V> callback;
-
-    private final FutureRequestExecutionMetrics metrics;
-
-    HttpRequestTaskCallable(
-            final HttpClient httpClient,
-            final ClassicHttpRequest request,
-            final HttpContext context,
-            final HttpClientResponseHandler<V> responseHandler,
-            final FutureCallback<V> callback,
-            final FutureRequestExecutionMetrics metrics) {
-        this.httpclient = httpClient;
-        this.responseHandler = responseHandler;
-        this.request = request;
-        this.context = context;
-        this.callback = callback;
-        this.metrics = metrics;
-    }
-
-    public long getScheduled() {
-        return scheduled;
-    }
-
-    public long getStarted() {
-        return started;
-    }
-
-    public long getEnded() {
-        return ended;
-    }
-
-    @Override
-    public V call() throws Exception {
-        if (!cancelled.get()) {
-            try {
-                metrics.getActiveConnections().incrementAndGet();
-                started = System.currentTimeMillis();
-                try {
-                    metrics.getScheduledConnections().decrementAndGet();
-                    final V result = httpclient.execute(request, responseHandler, context);
-                    ended = System.currentTimeMillis();
-                    metrics.getSuccessfulConnections().increment(started);
-                    if (callback != null) {
-                        callback.completed(result);
-                    }
-                    return result;
-                } catch (final Exception e) {
-                    metrics.getFailedConnections().increment(started);
-                    ended = System.currentTimeMillis();
-                    if (callback != null) {
-                        callback.failed(e);
-                    }
-                    throw e;
-                }
-            } finally {
-                metrics.getRequests().increment(started);
-                metrics.getTasks().increment(started);
-                metrics.getActiveConnections().decrementAndGet();
-            }
-        } else {
-            throw new IllegalStateException("call has been cancelled");
-        }
-    }
-
-    public void cancel() {
-        cancelled.set(true);
-        if (callback != null) {
-            callback.cancelled();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/InternalHttpClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/InternalHttpClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/InternalHttpClient.java
deleted file mode 100644
index a2df7f1..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/InternalHttpClient.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.impl.sync;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hc.client5.http.CancellableAware;
-import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.auth.AuthSchemeProvider;
-import org.apache.hc.client5.http.auth.CredentialsProvider;
-import org.apache.hc.client5.http.config.Configurable;
-import org.apache.hc.client5.http.config.RequestConfig;
-import org.apache.hc.client5.http.cookie.CookieSpecProvider;
-import org.apache.hc.client5.http.cookie.CookieStore;
-import org.apache.hc.client5.http.impl.ExecSupport;
-import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.protocol.ClientProtocolException;
-import org.apache.hc.client5.http.protocol.HttpClientContext;
-import org.apache.hc.client5.http.routing.HttpRoutePlanner;
-import org.apache.hc.client5.http.sync.ExecChain;
-import org.apache.hc.client5.http.sync.ExecRuntime;
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.ClassicHttpRequest;
-import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.config.Lookup;
-import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
-import org.apache.hc.core5.http.protocol.BasicHttpContext;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.net.URIAuthority;
-import org.apache.hc.core5.util.Args;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-/**
- * Internal class.
- *
- * @since 4.3
- */
-@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
-class InternalHttpClient extends CloseableHttpClient implements Configurable {
-
-    private final Logger log = LogManager.getLogger(getClass());
-
-    private final HttpClientConnectionManager connManager;
-    private final HttpRequestExecutor requestExecutor;
-    private final ExecChainElement execChain;
-    private final HttpRoutePlanner routePlanner;
-    private final Lookup<CookieSpecProvider> cookieSpecRegistry;
-    private final Lookup<AuthSchemeProvider> authSchemeRegistry;
-    private final CookieStore cookieStore;
-    private final CredentialsProvider credentialsProvider;
-    private final RequestConfig defaultConfig;
-    private final List<Closeable> closeables;
-
-    public InternalHttpClient(
-            final HttpClientConnectionManager connManager,
-            final HttpRequestExecutor requestExecutor,
-            final ExecChainElement execChain,
-            final HttpRoutePlanner routePlanner,
-            final Lookup<CookieSpecProvider> cookieSpecRegistry,
-            final Lookup<AuthSchemeProvider> authSchemeRegistry,
-            final CookieStore cookieStore,
-            final CredentialsProvider credentialsProvider,
-            final RequestConfig defaultConfig,
-            final List<Closeable> closeables) {
-        super();
-        this.connManager = Args.notNull(connManager, "Connection manager");
-        this.requestExecutor = Args.notNull(requestExecutor, "Request executor");
-        this.execChain = Args.notNull(execChain, "Execution chain");
-        this.routePlanner = Args.notNull(routePlanner, "Route planner");
-        this.cookieSpecRegistry = cookieSpecRegistry;
-        this.authSchemeRegistry = authSchemeRegistry;
-        this.cookieStore = cookieStore;
-        this.credentialsProvider = credentialsProvider;
-        this.defaultConfig = defaultConfig;
-        this.closeables = closeables;
-    }
-
-    private HttpRoute determineRoute(
-            final HttpHost host,
-            final HttpRequest request,
-            final HttpContext context) throws HttpException {
-        final HttpHost target = host != null ? host : this.routePlanner.determineTargetHost(request, context);
-        return this.routePlanner.determineRoute(target, context);
-    }
-
-    private void setupContext(final HttpClientContext context) {
-        if (context.getAttribute(HttpClientContext.AUTHSCHEME_REGISTRY) == null) {
-            context.setAttribute(HttpClientContext.AUTHSCHEME_REGISTRY, this.authSchemeRegistry);
-        }
-        if (context.getAttribute(HttpClientContext.COOKIESPEC_REGISTRY) == null) {
-            context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);
-        }
-        if (context.getAttribute(HttpClientContext.COOKIE_STORE) == null) {
-            context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
-        }
-        if (context.getAttribute(HttpClientContext.CREDS_PROVIDER) == null) {
-            context.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
-        }
-        if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
-            context.setAttribute(HttpClientContext.REQUEST_CONFIG, this.defaultConfig);
-        }
-    }
-
-    @Override
-    protected CloseableHttpResponse doExecute(
-            final HttpHost target,
-            final ClassicHttpRequest request,
-            final HttpContext context) throws IOException {
-        Args.notNull(request, "HTTP request");
-        try {
-            if (request.getScheme() == null && target != null) {
-                request.setScheme(target.getSchemeName());
-            }
-            if (request.getAuthority() == null && target != null) {
-                request.setAuthority(new URIAuthority(target));
-            }
-            final HttpClientContext localcontext = HttpClientContext.adapt(
-                    context != null ? context : new BasicHttpContext());
-            RequestConfig config = null;
-            if (request instanceof Configurable) {
-                config = ((Configurable) request).getConfig();
-            }
-            if (config != null) {
-                localcontext.setRequestConfig(config);
-            }
-            setupContext(localcontext);
-            final HttpRoute route = determineRoute(target, request, localcontext);
-            final ExecRuntime execRuntime = new ExecRuntimeImpl(log, connManager, requestExecutor,
-                    request instanceof CancellableAware ? (CancellableAware) request : null);
-            final ExecChain.Scope scope = new ExecChain.Scope(route, request, execRuntime, localcontext);
-            final ClassicHttpResponse response = this.execChain.execute(ExecSupport.copy(request), scope);
-            return CloseableHttpResponse.adapt(response);
-        } catch (final HttpException httpException) {
-            throw new ClientProtocolException(httpException.getMessage(), httpException);
-        }
-    }
-
-    @Override
-    public RequestConfig getConfig() {
-        return this.defaultConfig;
-    }
-
-    @Override
-    public void close() {
-        if (this.closeables != null) {
-            for (final Closeable closeable: this.closeables) {
-                try {
-                    closeable.close();
-                } catch (final IOException ex) {
-                    this.log.error(ex.getMessage(), ex);
-                }
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MainClientExec.java
deleted file mode 100644
index 51f86fc..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MainClientExec.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.impl.sync;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-
-import org.apache.hc.client5.http.ConnectionKeepAliveStrategy;
-import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.impl.ConnectionShutdownException;
-import org.apache.hc.client5.http.protocol.HttpClientContext;
-import org.apache.hc.client5.http.protocol.UserTokenHandler;
-import org.apache.hc.client5.http.sync.ExecChain;
-import org.apache.hc.client5.http.sync.ExecChainHandler;
-import org.apache.hc.client5.http.sync.ExecRuntime;
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.ClassicHttpRequest;
-import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.message.RequestLine;
-import org.apache.hc.core5.util.Args;
-import org.apache.hc.core5.util.TimeValue;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-/**
- * The last request executor in the HTTP request execution chain
- * that is responsible for execution of request / response
- * exchanges with the opposite endpoint.
- *
- * @since 4.3
- */
-@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
-final class MainClientExec implements ExecChainHandler {
-
-    private final Logger log = LogManager.getLogger(getClass());
-
-    private final ConnectionReuseStrategy reuseStrategy;
-    private final ConnectionKeepAliveStrategy keepAliveStrategy;
-    private final UserTokenHandler userTokenHandler;
-
-    /**
-     * @since 4.4
-     */
-    public MainClientExec(
-            final ConnectionReuseStrategy reuseStrategy,
-            final ConnectionKeepAliveStrategy keepAliveStrategy,
-            final UserTokenHandler userTokenHandler) {
-        Args.notNull(reuseStrategy, "Connection reuse strategy");
-        Args.notNull(keepAliveStrategy, "Connection keep alive strategy");
-        Args.notNull(userTokenHandler, "User token handler");
-        this.reuseStrategy      = reuseStrategy;
-        this.keepAliveStrategy  = keepAliveStrategy;
-        this.userTokenHandler   = userTokenHandler;
-    }
-
-    @Override
-    public ClassicHttpResponse execute(
-            final ClassicHttpRequest request,
-            final ExecChain.Scope scope,
-            final ExecChain chain) throws IOException, HttpException {
-        Args.notNull(request, "HTTP request");
-        Args.notNull(scope, "Scope");
-        final HttpRoute route = scope.route;
-        final HttpClientContext context = scope.clientContext;
-        final ExecRuntime execRuntime = scope.execRuntime;
-
-        try {
-            if (this.log.isDebugEnabled()) {
-                this.log.debug("Executing request " + new RequestLine(request));
-            }
-            RequestEntityProxy.enhance(request);
-
-            final ClassicHttpResponse response = execRuntime.execute(request, context);
-
-            Object userToken = context.getUserToken();
-            if (userToken == null) {
-                userToken = userTokenHandler.getUserToken(route, context);
-                context.setAttribute(HttpClientContext.USER_TOKEN, userToken);
-            }
-            if (userToken != null) {
-                execRuntime.setConnectionState(userToken);
-            }
-
-            // The connection is in or can be brought to a re-usable state.
-            if (reuseStrategy.keepAlive(request, response, context)) {
-                // Set the idle duration of this connection
-                final TimeValue duration = keepAliveStrategy.getKeepAliveDuration(response, context);
-                if (this.log.isDebugEnabled()) {
-                    final String s;
-                    if (duration != null) {
-                        s = "for " + duration;
-                    } else {
-                        s = "indefinitely";
-                    }
-                    this.log.debug("Connection can be kept alive " + s);
-                }
-                execRuntime.setConnectionValidFor(duration);
-                execRuntime.markConnectionReusable();
-            } else {
-                execRuntime.markConnectionNonReusable();
-            }
-            // check for entity, release connection if possible
-            final HttpEntity entity = response.getEntity();
-            if (entity == null || !entity.isStreaming()) {
-                // connection not needed and (assumed to be) in re-usable state
-                execRuntime.releaseConnection();
-                return new CloseableHttpResponse(response, null);
-            } else {
-                ResponseEntityProxy.enchance(response, execRuntime);
-                return new CloseableHttpResponse(response, execRuntime);
-            }
-        } catch (final ConnectionShutdownException ex) {
-            final InterruptedIOException ioex = new InterruptedIOException(
-                    "Connection has been shut down");
-            ioex.initCause(ex);
-            execRuntime.discardConnection();
-            throw ioex;
-        } catch (final HttpException | RuntimeException | IOException ex) {
-            execRuntime.discardConnection();
-            throw ex;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MinimalHttpClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MinimalHttpClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MinimalHttpClient.java
deleted file mode 100644
index 57b348b..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/MinimalHttpClient.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.impl.sync;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-
-import org.apache.hc.client5.http.CancellableAware;
-import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.config.Configurable;
-import org.apache.hc.client5.http.config.RequestConfig;
-import org.apache.hc.client5.http.impl.ConnectionShutdownException;
-import org.apache.hc.client5.http.impl.DefaultSchemePortResolver;
-import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.protocol.ClientProtocolException;
-import org.apache.hc.client5.http.protocol.HttpClientContext;
-import org.apache.hc.client5.http.protocol.RequestClientConnControl;
-import org.apache.hc.client5.http.sync.ExecRuntime;
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.ClassicHttpRequest;
-import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.core5.http.ConnectionReuseStrategy;
-import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
-import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
-import org.apache.hc.core5.http.protocol.BasicHttpContext;
-import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.http.protocol.HttpCoreContext;
-import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.RequestContent;
-import org.apache.hc.core5.http.protocol.RequestTargetHost;
-import org.apache.hc.core5.http.protocol.RequestUserAgent;
-import org.apache.hc.core5.net.URIAuthority;
-import org.apache.hc.core5.util.Args;
-import org.apache.hc.core5.util.VersionInfo;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-/**
- * Internal class.
- *
- * @since 4.3
- */
-@Contract(threading = ThreadingBehavior.SAFE)
-public class MinimalHttpClient extends CloseableHttpClient {
-
-    private final Logger log = LogManager.getLogger(getClass());
-
-    private final HttpClientConnectionManager connManager;
-    private final ConnectionReuseStrategy reuseStrategy;
-    private final HttpRequestExecutor requestExecutor;
-    private final HttpProcessor httpProcessor;
-
-    MinimalHttpClient(final HttpClientConnectionManager connManager) {
-        super();
-        this.connManager = Args.notNull(connManager, "HTTP connection manager");
-        this.reuseStrategy = DefaultConnectionReuseStrategy.INSTANCE;
-        this.requestExecutor = new HttpRequestExecutor(this.reuseStrategy);
-        this.httpProcessor = new DefaultHttpProcessor(
-                new RequestContent(),
-                new RequestTargetHost(),
-                new RequestClientConnControl(),
-                new RequestUserAgent(VersionInfo.getSoftwareInfo(
-                        "Apache-HttpClient", "org.apache.hc.client5", getClass())));
-    }
-
-    @Override
-    protected CloseableHttpResponse doExecute(
-            final HttpHost target,
-            final ClassicHttpRequest request,
-            final HttpContext context) throws IOException {
-        Args.notNull(target, "Target host");
-        Args.notNull(request, "HTTP request");
-        if (request.getScheme() == null) {
-            request.setScheme(target.getSchemeName());
-        }
-        if (request.getAuthority() == null) {
-            request.setAuthority(new URIAuthority(target));
-        }
-        final HttpClientContext clientContext = HttpClientContext.adapt(
-                context != null ? context : new BasicHttpContext());
-        RequestConfig config = null;
-        if (request instanceof Configurable) {
-            config = ((Configurable) request).getConfig();
-        }
-        if (config != null) {
-            clientContext.setRequestConfig(config);
-        }
-
-        final HttpRoute route = new HttpRoute(target.getPort() > 0 ? target : new HttpHost(
-                target.getHostName(),
-                DefaultSchemePortResolver.INSTANCE.resolve(target),
-                target.getSchemeName()));
-
-        final ExecRuntime execRuntime = new ExecRuntimeImpl(log, connManager, requestExecutor,
-                request instanceof CancellableAware ? (CancellableAware) request : null);
-        try {
-            if (!execRuntime.isConnectionAcquired()) {
-                execRuntime.acquireConnection(route, null, clientContext);
-            }
-            if (!execRuntime.isConnected()) {
-                execRuntime.connect(clientContext);
-            }
-
-            context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
-            context.setAttribute(HttpClientContext.HTTP_ROUTE, route);
-
-            httpProcessor.process(request, request.getEntity(), context);
-            final ClassicHttpResponse response = execRuntime.execute(request, clientContext);
-            httpProcessor.process(response, response.getEntity(), context);
-
-            if (reuseStrategy.keepAlive(request, response, context)) {
-                execRuntime.markConnectionReusable();
-            } else {
-                execRuntime.markConnectionNonReusable();
-            }
-
-            // check for entity, release connection if possible
-            final HttpEntity entity = response.getEntity();
-            if (entity == null || !entity.isStreaming()) {
-                // connection not needed and (assumed to be) in re-usable state
-                execRuntime.releaseConnection();
-                return new CloseableHttpResponse(response, null);
-            } else {
-                ResponseEntityProxy.enchance(response, execRuntime);
-                return new CloseableHttpResponse(response, execRuntime);
-            }
-        } catch (final ConnectionShutdownException ex) {
-            final InterruptedIOException ioex = new InterruptedIOException("Connection has been shut down");
-            ioex.initCause(ex);
-            execRuntime.discardConnection();
-            throw ioex;
-        } catch (final RuntimeException | IOException ex) {
-            execRuntime.discardConnection();
-            throw ex;
-        } catch (final HttpException httpException) {
-            execRuntime.discardConnection();
-            throw new ClientProtocolException(httpException);
-        }
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.connManager.close();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/6d17126c/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NullBackoffStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NullBackoffStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NullBackoffStrategy.java
deleted file mode 100644
index 5ae3ebe..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NullBackoffStrategy.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.client5.http.impl.sync;
-
-import org.apache.hc.client5.http.sync.ConnectionBackoffStrategy;
-import org.apache.hc.core5.http.HttpResponse;
-
-/**
- * This is a {@link ConnectionBackoffStrategy} that never backs off,
- * for compatibility with existing behavior.
- *
- * @since 4.2
- */
-public class NullBackoffStrategy implements ConnectionBackoffStrategy {
-
-    @Override
-    public boolean shouldBackoff(final Throwable t) {
-        return false;
-    }
-
-    @Override
-    public boolean shouldBackoff(final HttpResponse resp) {
-        return false;
-    }
-}