hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1784140 [2/4] - in /httpcomponents/httpclient/trunk: httpclient5-testing/docker/apache-httpd/ httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/ httpclient5-testing/src/test/resources/ httpclient5/src/examples/org/ap...
Date Thu, 23 Feb 2017 14:33:48 GMT
Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,445 @@
+/*
+ * ====================================================================
+ * 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.async.methods;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.hc.client5.http.config.RequestConfig;
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.NameValuePair;
+import org.apache.hc.core5.http.ProtocolVersion;
+import org.apache.hc.core5.http.message.BasicHeader;
+import org.apache.hc.core5.http.message.BasicHttpRequest;
+import org.apache.hc.core5.http.message.BasicNameValuePair;
+import org.apache.hc.core5.http.message.HeaderGroup;
+import org.apache.hc.core5.http.nio.AsyncEntityProducer;
+import org.apache.hc.core5.http.nio.AsyncRequestProducer;
+import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
+import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
+import org.apache.hc.core5.net.URIBuilder;
+import org.apache.hc.core5.net.URLEncodedUtils;
+import org.apache.hc.core5.util.Args;
+import org.apache.hc.core5.util.TextUtils;
+
+/**
+ * Builder for {@link AsyncRequestProducer} instances.
+ * <p>
+ * Please note that this class treats parameters differently depending on composition
+ * of the request: if the request has a content entity explicitly set with
+ * {@link #setEntity(AsyncEntityProducer)} or it is not an entity enclosing method
+ * (such as POST or PUT), parameters will be added to the query component of the request URI.
+ * Otherwise, parameters will be added as a URL encoded entity.
+ *
+ * @since 5.0
+ */
+public class AsyncRequestBuilder {
+
+    private enum METHOD { GET, HEAD, POST, PUT, DELETE, PATCH, TRACE, OPTIONS }
+
+    private HttpHost host;
+    private String path;
+    private URI uri;
+    private String method;
+    private Charset charset;
+    private ProtocolVersion version;
+    private HeaderGroup headergroup;
+    private AsyncEntityProducer entityProducer;
+    private List<NameValuePair> parameters;
+    private RequestConfig config;
+
+    AsyncRequestBuilder() {
+    }
+
+    AsyncRequestBuilder(final String method) {
+        super();
+        this.method = method;
+    }
+
+    AsyncRequestBuilder(final METHOD method) {
+        this(method.name());
+    }
+
+    AsyncRequestBuilder(final String method, final URI uri) {
+        super();
+        this.method = method;
+        this.uri = uri;
+    }
+
+    AsyncRequestBuilder(final METHOD method, final HttpHost host, final String path) {
+        super();
+        this.method = method.name();
+        this.host = host;
+        this.path = path;
+    }
+
+    AsyncRequestBuilder(final METHOD method, final URI uri) {
+        this(method.name(), uri);
+    }
+
+    AsyncRequestBuilder(final METHOD method, final String uri) {
+        this(method.name(), uri != null ? URI.create(uri) : null);
+    }
+
+    AsyncRequestBuilder(final String method, final String uri) {
+        this(method, uri != null ? URI.create(uri) : null);
+    }
+
+    public static AsyncRequestBuilder create(final String method) {
+        Args.notBlank(method, "HTTP method");
+        return new AsyncRequestBuilder(method);
+    }
+
+    public static AsyncRequestBuilder get() {
+        return new AsyncRequestBuilder(METHOD.GET);
+    }
+
+    public static AsyncRequestBuilder get(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.GET, uri);
+    }
+
+    public static AsyncRequestBuilder get(final String uri) {
+        return new AsyncRequestBuilder(METHOD.GET, uri);
+    }
+
+    public static AsyncRequestBuilder get(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.GET, host, path);
+    }
+
+    public static AsyncRequestBuilder head() {
+        return new AsyncRequestBuilder(METHOD.HEAD);
+    }
+
+    public static AsyncRequestBuilder head(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.HEAD, uri);
+    }
+
+    public static AsyncRequestBuilder head(final String uri) {
+        return new AsyncRequestBuilder(METHOD.HEAD, uri);
+    }
+
+    public static AsyncRequestBuilder head(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.HEAD, host, path);
+    }
+
+    public static AsyncRequestBuilder patch() {
+        return new AsyncRequestBuilder(METHOD.PATCH);
+    }
+
+    public static AsyncRequestBuilder patch(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.PATCH, uri);
+    }
+
+    public static AsyncRequestBuilder patch(final String uri) {
+        return new AsyncRequestBuilder(METHOD.PATCH, uri);
+    }
+
+    public static AsyncRequestBuilder patch(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.PATCH, host, path);
+    }
+
+    public static AsyncRequestBuilder post() {
+        return new AsyncRequestBuilder(METHOD.POST);
+    }
+
+    public static AsyncRequestBuilder post(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.POST, uri);
+    }
+
+    public static AsyncRequestBuilder post(final String uri) {
+        return new AsyncRequestBuilder(METHOD.POST, uri);
+    }
+
+    public static AsyncRequestBuilder post(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.POST, host, path);
+    }
+
+    public static AsyncRequestBuilder put() {
+        return new AsyncRequestBuilder(METHOD.PUT);
+    }
+
+    public static AsyncRequestBuilder put(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.PUT, uri);
+    }
+
+    public static AsyncRequestBuilder put(final String uri) {
+        return new AsyncRequestBuilder(METHOD.PUT, uri);
+    }
+
+    public static AsyncRequestBuilder put(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.PUT, host, path);
+    }
+
+    public static AsyncRequestBuilder delete() {
+        return new AsyncRequestBuilder(METHOD.DELETE);
+    }
+
+    public static AsyncRequestBuilder delete(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.DELETE, uri);
+    }
+
+    public static AsyncRequestBuilder delete(final String uri) {
+        return new AsyncRequestBuilder(METHOD.DELETE, uri);
+    }
+
+    public static AsyncRequestBuilder delete(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.DELETE, host, path);
+    }
+
+    public static AsyncRequestBuilder trace() {
+        return new AsyncRequestBuilder(METHOD.TRACE);
+    }
+
+    public static AsyncRequestBuilder trace(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.TRACE, uri);
+    }
+
+    public static AsyncRequestBuilder trace(final String uri) {
+        return new AsyncRequestBuilder(METHOD.TRACE, uri);
+    }
+
+    public static AsyncRequestBuilder trace(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.TRACE, host, path);
+    }
+
+    public static AsyncRequestBuilder options() {
+        return new AsyncRequestBuilder(METHOD.OPTIONS);
+    }
+
+    public static AsyncRequestBuilder options(final URI uri) {
+        return new AsyncRequestBuilder(METHOD.OPTIONS, uri);
+    }
+
+    public static AsyncRequestBuilder options(final String uri) {
+        return new AsyncRequestBuilder(METHOD.OPTIONS, uri);
+    }
+
+    public static AsyncRequestBuilder options(final HttpHost host, final String path) {
+        return new AsyncRequestBuilder(METHOD.OPTIONS, host, path);
+    }
+
+    public AsyncRequestBuilder setCharset(final Charset charset) {
+        this.charset = charset;
+        return this;
+    }
+
+    public Charset getCharset() {
+        return charset;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    public AsyncRequestBuilder setUri(final URI uri) {
+        this.uri = uri;
+        this.host = null;
+        this.path = null;
+        return this;
+    }
+
+    public AsyncRequestBuilder setUri(final String uri) {
+        this.uri = uri != null ? URI.create(uri) : null;
+        this.host = null;
+        this.path = null;
+        return this;
+    }
+
+    public ProtocolVersion getVersion() {
+        return version;
+    }
+
+    public AsyncRequestBuilder setVersion(final ProtocolVersion version) {
+        this.version = version;
+        return this;
+    }
+
+    public Header getFirstHeader(final String name) {
+        return headergroup != null ? headergroup.getFirstHeader(name) : null;
+    }
+
+    public Header getLastHeader(final String name) {
+        return headergroup != null ? headergroup.getLastHeader(name) : null;
+    }
+
+    public Header[] getHeaders(final String name) {
+        return headergroup != null ? headergroup.getHeaders(name) : null;
+    }
+
+    public AsyncRequestBuilder addHeader(final Header header) {
+        if (headergroup == null) {
+            headergroup = new HeaderGroup();
+        }
+        headergroup.addHeader(header);
+        return this;
+    }
+
+    public AsyncRequestBuilder addHeader(final String name, final String value) {
+        if (headergroup == null) {
+            headergroup = new HeaderGroup();
+        }
+        this.headergroup.addHeader(new BasicHeader(name, value));
+        return this;
+    }
+
+    public AsyncRequestBuilder removeHeader(final Header header) {
+        if (headergroup == null) {
+            headergroup = new HeaderGroup();
+        }
+        headergroup.removeHeader(header);
+        return this;
+    }
+
+    public AsyncRequestBuilder removeHeaders(final String name) {
+        if (name == null || headergroup == null) {
+            return this;
+        }
+        for (final Iterator<Header> i = headergroup.headerIterator(); i.hasNext(); ) {
+            final Header header = i.next();
+            if (name.equalsIgnoreCase(header.getName())) {
+                i.remove();
+            }
+        }
+        return this;
+    }
+
+    public AsyncRequestBuilder setHeader(final Header header) {
+        if (headergroup == null) {
+            headergroup = new HeaderGroup();
+        }
+        this.headergroup.setHeader(header);
+        return this;
+    }
+
+    public AsyncRequestBuilder setHeader(final String name, final String value) {
+        if (headergroup == null) {
+            headergroup = new HeaderGroup();
+        }
+        this.headergroup.setHeader(new BasicHeader(name, value));
+        return this;
+    }
+
+    public List<NameValuePair> getParameters() {
+        return parameters != null ? new ArrayList<>(parameters) :
+            new ArrayList<NameValuePair>();
+    }
+
+    public AsyncRequestBuilder addParameter(final NameValuePair nvp) {
+        Args.notNull(nvp, "Name value pair");
+        if (parameters == null) {
+            parameters = new LinkedList<>();
+        }
+        parameters.add(nvp);
+        return this;
+    }
+
+    public AsyncRequestBuilder addParameter(final String name, final String value) {
+        return addParameter(new BasicNameValuePair(name, value));
+    }
+
+    public AsyncRequestBuilder addParameters(final NameValuePair... nvps) {
+        for (final NameValuePair nvp: nvps) {
+            addParameter(nvp);
+        }
+        return this;
+    }
+
+    public RequestConfig getConfig() {
+        return config;
+    }
+
+    public AsyncRequestBuilder setConfig(final RequestConfig config) {
+        this.config = config;
+        return this;
+    }
+
+    public AsyncEntityProducer getEntity() {
+        return entityProducer;
+    }
+
+    public AsyncRequestBuilder setEntity(final AsyncEntityProducer entityProducer) {
+        this.entityProducer = entityProducer;
+        return this;
+    }
+
+    public AsyncRequestBuilder setEntity(final String content, final ContentType contentType) {
+        this.entityProducer = new BasicAsyncEntityProducer(content, contentType);
+        return this;
+    }
+
+    public AsyncRequestBuilder setEntity(final byte[] content, final ContentType contentType) {
+        this.entityProducer = new BasicAsyncEntityProducer(content, contentType);
+        return this;
+    }
+
+    public AsyncRequestProducer build() {
+        AsyncEntityProducer entityProducerCopy = this.entityProducer;
+        if (parameters != null && !parameters.isEmpty()) {
+            if (entityProducerCopy == null && (METHOD.POST.name().equalsIgnoreCase(method)
+                    || METHOD.PUT.name().equalsIgnoreCase(method))) {
+                final String content = URLEncodedUtils.format(
+                        parameters,
+                        charset != null ? charset : ContentType.APPLICATION_FORM_URLENCODED.getCharset());
+                entityProducerCopy = new StringAsyncEntityProducer(
+                        content,
+                        ContentType.APPLICATION_FORM_URLENCODED);
+            } else {
+                try {
+                    uri = new URIBuilder(uri)
+                      .setCharset(this.charset)
+                      .addParameters(parameters)
+                      .build();
+                } catch (final URISyntaxException ex) {
+                    // should never happen
+                }
+            }
+        }
+        final BasicHttpRequest request = host != null ?
+                new BasicHttpRequest(method, host, !TextUtils.isBlank(path) ? path : "/") :
+                new BasicHttpRequest(method, uri != null ? uri : URI.create("/"));
+        if (this.headergroup != null) {
+            request.setHeaders(this.headergroup.getAllHeaders());
+        }
+        if (version != null) {
+            request.setVersion(version);
+        }
+        return new DefaultAsyncRequestProducer(request, entityProducerCopy, config);
+    }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,96 @@
+/*
+ * ====================================================================
+ * 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.async.methods;
+
+import java.io.IOException;
+
+import org.apache.hc.client5.http.config.RequestConfig;
+import org.apache.hc.client5.http.methods.Configurable;
+import org.apache.hc.core5.http.EntityDetails;
+import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.nio.AsyncEntityProducer;
+import org.apache.hc.core5.http.nio.AsyncRequestProducer;
+import org.apache.hc.core5.http.nio.DataStreamChannel;
+import org.apache.hc.core5.util.Args;
+
+public class DefaultAsyncRequestProducer implements AsyncRequestProducer, Configurable {
+
+    private final HttpRequest request;
+    private final AsyncEntityProducer entityProducer;
+    private final RequestConfig config;
+
+    public DefaultAsyncRequestProducer(final HttpRequest request, final AsyncEntityProducer entityProducer, final RequestConfig config) {
+        Args.notNull(request, "Request");
+        this.request = request;
+        this.entityProducer = entityProducer;
+        this.config = config;
+    }
+
+    public DefaultAsyncRequestProducer(final HttpRequest request, final AsyncEntityProducer entityProducer) {
+        this(request, entityProducer, null);
+    }
+
+    @Override
+    public RequestConfig getConfig() {
+        return config;
+    }
+
+    @Override
+    public final HttpRequest produceRequest() {
+        return request;
+    }
+
+    @Override
+    public final EntityDetails getEntityDetails() {
+        return entityProducer;
+    }
+
+    @Override
+    public final int available() {
+        return entityProducer != null ? entityProducer.available() : 0;
+    }
+
+    @Override
+    public final void produce(final DataStreamChannel channel) throws IOException {
+        if (entityProducer != null) {
+            entityProducer.produce(channel);
+        }
+    }
+
+    @Override
+    public final void failed(final Exception cause) {
+        releaseResources();
+    }
+
+    @Override
+    public final void releaseResources() {
+        if (entityProducer != null) {
+            entityProducer.releaseResources();
+        }
+    }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/DefaultAsyncRequestProducer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,75 @@
+/*
+ * ====================================================================
+ * 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.async.methods;
+
+import java.net.URI;
+
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.message.BasicHttpRequest;
+import org.apache.hc.core5.http.message.HttpRequestWrapper;
+
+public final class SimpleHttpRequest extends HttpRequestWrapper {
+
+    private final String body;
+    private final ContentType contentType;
+
+    public SimpleHttpRequest(final HttpRequest head, final String body, final ContentType contentType) {
+        super(head);
+        this.body = body;
+        this.contentType = contentType;
+    }
+
+    public SimpleHttpRequest(
+            final String method,
+            final HttpHost host,
+            final String path,
+            final String body,
+            final ContentType contentType) {
+        super(new BasicHttpRequest(method, host, path));
+        this.body = body;
+        this.contentType = contentType;
+    }
+
+    public SimpleHttpRequest(final String method, final URI requestUri, final String body, final ContentType contentType) {
+        super(new BasicHttpRequest(method, requestUri));
+        this.body = body;
+        this.contentType = contentType;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public ContentType getContentType() {
+        return contentType;
+    }
+
+}
+

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,74 @@
+/*
+ * ====================================================================
+ * 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.async.methods;
+
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.message.BasicHttpResponse;
+import org.apache.hc.core5.http.message.HttpResponseWrapper;
+
+public final class SimpleHttpResponse extends HttpResponseWrapper {
+
+    private final String body;
+    private final ContentType contentType;
+
+    public SimpleHttpResponse(
+            final HttpResponse head,
+            final String body,
+            final ContentType contentType) {
+        super(head);
+        this.body = body;
+        this.contentType = contentType;
+    }
+
+    public SimpleHttpResponse(
+            final int code,
+            final String reasonPhrase,
+            final String body,
+            final ContentType contentType) {
+        super(new BasicHttpResponse(code, reasonPhrase));
+        this.body = body;
+        this.contentType = contentType;
+    }
+
+    public SimpleHttpResponse(final int code, final String body, final ContentType contentType) {
+        super(new BasicHttpResponse(code));
+        this.body = body;
+        this.contentType = contentType;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public ContentType getContentType() {
+        return contentType;
+    }
+
+}
+

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java (from r1784139, httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java?p2=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java&p1=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java&r1=1784139&r2=1784140&rev=1784140&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java Thu Feb 23 14:33:47 2017
@@ -24,27 +24,16 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.client5.http.impl.sync;
+package org.apache.hc.client5.http.async.methods;
 
-import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.protocol.UserTokenHandler;
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.protocol.HttpContext;
+import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
+import org.apache.hc.core5.util.Args;
 
-/**
- * Noop implementation of {@link UserTokenHandler} that always returns {@code null}.
- *
- * @since 4.3
- */
-@Contract(threading = ThreadingBehavior.IMMUTABLE)
-public class NoopUserTokenHandler implements UserTokenHandler {
-
-    public static final NoopUserTokenHandler INSTANCE = new NoopUserTokenHandler();
+public final class SimpleRequestProducer extends DefaultAsyncRequestProducer {
 
-    @Override
-    public Object getUserToken(final HttpRoute route, final HttpContext context) {
-        return null;
+    public SimpleRequestProducer(final SimpleHttpRequest request) {
+        super(Args.notNull(request, "Request"), request.getBody() != null ?
+                new StringAsyncEntityProducer(request.getBody(), request.getContentType()) : null);
     }
 
 }

Copied: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java (from r1784139, httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java?p2=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java&p1=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java&r1=1784139&r2=1784140&rev=1784140&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java Thu Feb 23 14:33:47 2017
@@ -24,27 +24,21 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.client5.http.impl.sync;
+package org.apache.hc.client5.http.async.methods;
 
-import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.protocol.UserTokenHandler;
-import org.apache.hc.core5.annotation.Contract;
-import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.protocol.HttpContext;
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
 
-/**
- * Noop implementation of {@link UserTokenHandler} that always returns {@code null}.
- *
- * @since 4.3
- */
-@Contract(threading = ThreadingBehavior.IMMUTABLE)
-public class NoopUserTokenHandler implements UserTokenHandler {
+public final class SimpleResponseConsumer extends AbstractAsyncResponseConsumer<SimpleHttpResponse, String> {
 
-    public static final NoopUserTokenHandler INSTANCE = new NoopUserTokenHandler();
+    public SimpleResponseConsumer() {
+        super(new StringAsyncEntityConsumer());
+    }
 
     @Override
-    public Object getUserToken(final HttpRoute route, final HttpContext context) {
-        return null;
+    protected SimpleHttpResponse buildResult(final HttpResponse response, final String entity, final ContentType contentType) {
+        return new SimpleHttpResponse(response, entity, contentType);
     }
 
-}
+}
\ No newline at end of file

Copied: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java (from r1784139, httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/protocol/DefaultUserTokenHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java?p2=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java&p1=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/protocol/DefaultUserTokenHandler.java&r1=1784139&r2=1784140&rev=1784140&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/protocol/DefaultUserTokenHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java Thu Feb 23 14:33:47 2017
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.client5.http.impl.protocol;
+package org.apache.hc.client5.http.impl;
 
 import java.security.Principal;
 

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultUserTokenHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java (from r1784139, httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/IdleConnectionEvictor.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java?p2=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java&p1=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/IdleConnectionEvictor.java&r1=1784139&r2=1784140&rev=1784140&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/IdleConnectionEvictor.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java Thu Feb 23 14:33:47 2017
@@ -25,12 +25,11 @@
  *
  */
 
-package org.apache.hc.client5.http.impl.sync;
+package org.apache.hc.client5.http.impl;
 
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.hc.client5.http.impl.DefaultThreadFactory;
 import org.apache.hc.core5.pool.ConnPoolControl;
 import org.apache.hc.core5.util.Args;
 

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/NoopUserTokenHandler.java (from r1784139, httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/NoopUserTokenHandler.java?p2=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/NoopUserTokenHandler.java&p1=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java&r1=1784139&r2=1784140&rev=1784140&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/NoopUserTokenHandler.java Thu Feb 23 14:33:47 2017
@@ -24,7 +24,7 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.client5.http.impl.sync;
+package org.apache.hc.client5.http.impl;
 
 import org.apache.hc.client5.http.HttpRoute;
 import org.apache.hc.client5.http.protocol.UserTokenHandler;

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,153 @@
+/*
+ * ====================================================================
+ * 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.async;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.hc.core5.function.Callback;
+import org.apache.hc.core5.http.ExceptionListener;
+import org.apache.hc.core5.http.nio.command.ShutdownCommand;
+import org.apache.hc.core5.http.nio.command.ShutdownType;
+import org.apache.hc.core5.reactor.ConnectionInitiator;
+import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
+import org.apache.hc.core5.reactor.ExceptionEvent;
+import org.apache.hc.core5.reactor.IOEventHandlerFactory;
+import org.apache.hc.core5.reactor.IOReactorConfig;
+import org.apache.hc.core5.reactor.IOReactorException;
+import org.apache.hc.core5.reactor.IOReactorStatus;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+abstract class AbstractHttpAsyncClientBase extends CloseableHttpAsyncClient {
+
+    enum Status { READY, RUNNING, TERMINATED }
+
+    final Logger log = LogManager.getLogger(getClass());
+
+    private final DefaultConnectingIOReactor ioReactor;
+    private final ExceptionListener exceptionListener;
+    private final ExecutorService executorService;
+    private final AtomicReference<Status> status;
+
+    public AbstractHttpAsyncClientBase(
+            final IOEventHandlerFactory eventHandlerFactory,
+            final IOReactorConfig reactorConfig,
+            final ThreadFactory threadFactory,
+            final ThreadFactory workerThreadFactory) throws IOReactorException {
+        super();
+        this.ioReactor = new DefaultConnectingIOReactor(
+                eventHandlerFactory,
+                reactorConfig,
+                workerThreadFactory,
+                new Callback<IOSession>() {
+
+                    @Override
+                    public void execute(final IOSession ioSession) {
+                        ioSession.addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+                    }
+
+                });
+        this.exceptionListener = new ExceptionListener() {
+            @Override
+            public void onError(final Exception ex) {
+                log.error(ex.getMessage(), ex);
+            }
+        };
+        this.executorService = Executors.newSingleThreadExecutor(threadFactory);
+        this.status = new AtomicReference<>(Status.READY);
+    }
+
+    @Override
+    public final void start() {
+        if (status.compareAndSet(Status.READY, Status.RUNNING)) {
+            executorService.execute(new Runnable() {
+
+                @Override
+                public void run() {
+                    try {
+                        ioReactor.execute();
+                    } catch (Exception ex) {
+                        if (exceptionListener != null) {
+                            exceptionListener.onError(ex);
+                        }
+                    }
+                }
+            });
+        }
+    }
+
+    void ensureRunning() {
+        switch (status.get()) {
+            case READY:
+                throw new IllegalStateException("Client is not running");
+            case TERMINATED:
+                throw new IllegalStateException("Client has been terminated");
+        }
+    }
+
+    ConnectionInitiator getConnectionInitiator() {
+        return ioReactor;
+    }
+
+    @Override
+    public final IOReactorStatus getStatus() {
+        return ioReactor.getStatus();
+    }
+
+    @Override
+    public final List<ExceptionEvent> getAuditLog() {
+        return ioReactor.getAuditLog();
+    }
+
+    @Override
+    public final void awaitShutdown(final long deadline, final TimeUnit timeUnit) throws InterruptedException {
+        ioReactor.awaitShutdown(deadline, timeUnit);
+    }
+
+    @Override
+    public final void initiateShutdown() {
+        ioReactor.initiateShutdown();
+    }
+
+    @Override
+    public final void shutdown(final long graceTime, final TimeUnit timeUnit) {
+        ioReactor.initiateShutdown();
+        ioReactor.shutdown(graceTime, timeUnit);
+    }
+
+    @Override
+    public void close() {
+        shutdown(5, TimeUnit.SECONDS);
+    }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,79 @@
+/*
+ * ====================================================================
+ * 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.async;
+
+import java.io.Closeable;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hc.client5.http.async.AsyncClientEndpoint;
+import org.apache.hc.client5.http.async.HttpAsyncClient;
+import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.concurrent.FutureCallback;
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.nio.AsyncRequestProducer;
+import org.apache.hc.core5.http.nio.AsyncResponseConsumer;
+import org.apache.hc.core5.reactor.ExceptionEvent;
+import org.apache.hc.core5.reactor.IOReactorStatus;
+
+/**
+ * Base implementation of {@link HttpAsyncClient} that also implements {@link Closeable}.
+ *
+ * @since 4.0
+ */
+@Contract(threading = ThreadingBehavior.SAFE)
+public abstract class CloseableHttpAsyncClient implements HttpAsyncClient, Closeable {
+
+    public abstract void start();
+
+    public abstract IOReactorStatus getStatus();
+
+    public abstract List<ExceptionEvent> getAuditLog();
+
+    public abstract void awaitShutdown(long deadline, TimeUnit timeUnit) throws InterruptedException;
+
+    public abstract void initiateShutdown();
+
+    public abstract void shutdown(long graceTime, TimeUnit timeUnit);
+
+    public final Future<AsyncClientEndpoint> lease(
+            final HttpHost host,
+            final FutureCallback<AsyncClientEndpoint> callback) {
+        return lease(host, HttpClientContext.create(), callback);
+    }
+
+    public final <T> Future<T> execute(
+            final AsyncRequestProducer requestProducer,
+            final AsyncResponseConsumer<T> responseConsumer,
+            final FutureCallback<T> callback) {
+        return execute(requestProducer, responseConsumer, HttpClientContext.create(), callback);
+    }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,184 @@
+/*
+ * ====================================================================
+ * 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.async;
+
+import java.util.Iterator;
+
+import org.apache.hc.client5.http.impl.ConnPoolSupport;
+import org.apache.hc.client5.http.impl.logging.LoggingIOEventHandler;
+import org.apache.hc.client5.http.impl.logging.LoggingIOSession;
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ConnectionClosedException;
+import org.apache.hc.core5.http.ConnectionReuseStrategy;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpConnection;
+import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.config.ConnectionConfig;
+import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.impl.ConnectionListener;
+import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
+import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
+import org.apache.hc.core5.http.impl.Http1StreamListener;
+import org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler;
+import org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer;
+import org.apache.hc.core5.http.impl.nio.DefaultHttpRequestWriterFactory;
+import org.apache.hc.core5.http.impl.nio.DefaultHttpResponseParserFactory;
+import org.apache.hc.core5.http.message.RequestLine;
+import org.apache.hc.core5.http.message.StatusLine;
+import org.apache.hc.core5.http.protocol.HttpProcessor;
+import org.apache.hc.core5.reactor.IOEventHandler;
+import org.apache.hc.core5.reactor.IOEventHandlerFactory;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.hc.core5.util.Args;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * @since 5.0
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class DefaultAsyncHttp1ClientEventHandlerFactory implements IOEventHandlerFactory {
+
+    private final Logger streamLog = LogManager.getLogger(ClientHttp1StreamDuplexer.class);
+    private final Logger wireLog = LogManager.getLogger("org.apache.hc.client5.http.wire");
+    private final Logger headerLog = LogManager.getLogger("org.apache.hc.client5.http.headers");
+
+    private final HttpProcessor httpProcessor;
+    private final H1Config h1Config;
+    private final ConnectionConfig connectionConfig;
+    private final ConnectionReuseStrategy connectionReuseStrategy;
+
+    DefaultAsyncHttp1ClientEventHandlerFactory(
+            final HttpProcessor httpProcessor,
+            final H1Config h1Config,
+            final ConnectionConfig connectionConfig,
+            final ConnectionReuseStrategy connectionReuseStrategy) {
+        this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
+        this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
+        this.connectionConfig = connectionConfig != null ? connectionConfig: ConnectionConfig.DEFAULT;
+        this.connectionReuseStrategy = connectionReuseStrategy != null ? connectionReuseStrategy :
+                DefaultConnectionReuseStrategy.INSTANCE;
+    }
+
+    @Override
+    public IOEventHandler createHandler(final IOSession ioSession) {
+        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
+        if (sessionLog.isDebugEnabled()
+                || streamLog.isDebugEnabled()
+                || wireLog.isDebugEnabled()
+                || headerLog.isDebugEnabled()) {
+            final String id = ConnPoolSupport.getId(ioSession);
+            final ClientHttp1StreamDuplexer streamDuplexer = new ClientHttp1StreamDuplexer(
+                    new LoggingIOSession(ioSession, id, sessionLog, wireLog),
+                    httpProcessor,
+                    h1Config,
+                    connectionConfig,
+                    connectionReuseStrategy,
+                    DefaultHttpResponseParserFactory.INSTANCE.create(h1Config),
+                    DefaultHttpRequestWriterFactory.INSTANCE.create(),
+                    DefaultContentLengthStrategy.INSTANCE,
+                    DefaultContentLengthStrategy.INSTANCE,
+                    new ConnectionListener() {
+
+                        @Override
+                        public void onConnect(final HttpConnection connection) {
+                            if (streamLog.isDebugEnabled()) {
+                                streamLog.debug(id + ": "  + connection + " connected");
+                            }
+                        }
+
+                        @Override
+                        public void onDisconnect(final HttpConnection connection) {
+                            if (streamLog.isDebugEnabled()) {
+                                streamLog.debug(id + ": "  + connection + " disconnected");
+                            }
+                        }
+
+                        @Override
+                        public void onError(final HttpConnection connection, final Exception ex) {
+                            if (ex instanceof ConnectionClosedException) {
+                                return;
+                            }
+                            streamLog.error(id + ": "  + ex.getMessage(), ex);
+                        }
+
+                    },
+                    new Http1StreamListener() {
+
+                        @Override
+                        public void onRequestHead(final HttpConnection connection, final HttpRequest request) {
+                            if (headerLog.isDebugEnabled()) {
+                                headerLog.debug(id + " >> " + new RequestLine(request));
+                                for (final Iterator<Header> it = request.headerIterator(); it.hasNext(); ) {
+                                    headerLog.debug(id + " >> " + it.next());
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onResponseHead(final HttpConnection connection, final HttpResponse response) {
+                            if (headerLog.isDebugEnabled()) {
+                                headerLog.debug(id + " << " + new StatusLine(response));
+                                for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) {
+                                    headerLog.debug(id + " << " + it.next());
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onExchangeComplete(final HttpConnection connection, final boolean keepAlive) {
+                            if (streamLog.isDebugEnabled()) {
+                                if (keepAlive) {
+                                    streamLog.debug(id + " Connection is kept alive");
+                                } else {
+                                    streamLog.debug(id + " Connection is not kept alive");
+                                }
+                            }
+                        }
+
+                    });
+            return new LoggingIOEventHandler(new ClientHttp1IOEventHandler(streamDuplexer), id, sessionLog);
+        } else {
+            final ClientHttp1StreamDuplexer streamDuplexer = new ClientHttp1StreamDuplexer(
+                    ioSession,
+                    httpProcessor,
+                    h1Config,
+                    connectionConfig,
+                    connectionReuseStrategy,
+                    DefaultHttpResponseParserFactory.INSTANCE.create(h1Config),
+                    DefaultHttpRequestWriterFactory.INSTANCE.create(),
+                    DefaultContentLengthStrategy.INSTANCE,
+                    DefaultContentLengthStrategy.INSTANCE,
+                    null, null);
+            return new ClientHttp1IOEventHandler(streamDuplexer);
+        }
+    }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp1ClientEventHandlerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java?rev=1784140&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java (added)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java Thu Feb 23 14:33:47 2017
@@ -0,0 +1,217 @@
+/*
+ * ====================================================================
+ * 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.async;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.List;
+
+import org.apache.hc.client5.http.impl.ConnPoolSupport;
+import org.apache.hc.client5.http.impl.logging.LogAppendable;
+import org.apache.hc.client5.http.impl.logging.LoggingIOEventHandler;
+import org.apache.hc.client5.http.impl.logging.LoggingIOSession;
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http.ConnectionClosedException;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpConnection;
+import org.apache.hc.core5.http.impl.ConnectionListener;
+import org.apache.hc.core5.http.nio.AsyncPushConsumer;
+import org.apache.hc.core5.http.nio.HandlerFactory;
+import org.apache.hc.core5.http.protocol.HttpProcessor;
+import org.apache.hc.core5.http2.config.H2Config;
+import org.apache.hc.core5.http2.frame.FramePrinter;
+import org.apache.hc.core5.http2.frame.RawFrame;
+import org.apache.hc.core5.http2.impl.nio.ClientHttpProtocolNegotiator;
+import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
+import org.apache.hc.core5.reactor.IOEventHandler;
+import org.apache.hc.core5.reactor.IOEventHandlerFactory;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.hc.core5.util.Args;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * @since 5.0
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class DefaultAsyncHttp2ClientEventHandlerFactory implements IOEventHandlerFactory {
+
+    private final Logger streamLog = LogManager.getLogger(ClientHttpProtocolNegotiator.class);
+    private final Logger wireLog = LogManager.getLogger("org.apache.hc.client5.http.wire");
+    private final Logger headerLog = LogManager.getLogger("org.apache.hc.client5.http.headers");
+    private final Logger frameLog = LogManager.getLogger("org.apache.hc.client5.http2.frame");
+    private final Logger framePayloadLog = LogManager.getLogger("org.apache.hc.client5.http2.frame.payload");
+    private final Logger flowCtrlLog = LogManager.getLogger("org.apache.hc.client5.http2.flow");
+
+    private final HttpProcessor httpProcessor;
+    private final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory;
+    private final Charset charset;
+    private final H2Config h2Config;
+
+    DefaultAsyncHttp2ClientEventHandlerFactory(
+            final HttpProcessor httpProcessor,
+            final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory,
+            final Charset charset,
+            final H2Config h2Config) {
+        this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
+        this.exchangeHandlerFactory = exchangeHandlerFactory;
+        this.charset = charset;
+        this.h2Config = h2Config;
+    }
+
+    @Override
+    public IOEventHandler createHandler(final IOSession ioSession) {
+        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
+        if (sessionLog.isDebugEnabled()
+                || streamLog.isDebugEnabled()
+                || wireLog.isDebugEnabled()
+                || headerLog.isDebugEnabled()
+                || frameLog.isDebugEnabled()
+                || framePayloadLog.isDebugEnabled()
+                || flowCtrlLog.isDebugEnabled()) {
+            final String id = ConnPoolSupport.getId(ioSession);
+            return new LoggingIOEventHandler(new DefaultAsyncHttpClientProtocolNegotiator(
+                    new LoggingIOSession(ioSession, id, sessionLog, wireLog),
+                    httpProcessor, exchangeHandlerFactory, charset, h2Config,
+                    new ConnectionListener() {
+
+                        @Override
+                        public void onConnect(final HttpConnection connection) {
+                            if (streamLog.isDebugEnabled()) {
+                                streamLog.debug(id + ": " + connection + " connected");
+                            }
+                        }
+
+                        @Override
+                        public void onDisconnect(final HttpConnection connection) {
+                            if (streamLog.isDebugEnabled()) {
+                                streamLog.debug(id + ": " + connection + " disconnected");
+                            }
+                        }
+
+                        @Override
+                        public void onError(final HttpConnection connection, final Exception ex) {
+                            if (ex instanceof ConnectionClosedException) {
+                                return;
+                            }
+                            streamLog.error(id + ": " + ex.getMessage(), ex);
+                        }
+
+                    },
+                    new Http2StreamListener() {
+
+                        final FramePrinter framePrinter = new FramePrinter();
+
+                        private void logFrameInfo(final String prefix, final RawFrame frame) {
+                            try {
+                                final LogAppendable logAppendable = new LogAppendable(frameLog, prefix);
+                                framePrinter.printFrameInfo(frame, logAppendable);
+                                logAppendable.flush();
+                            } catch (IOException ignore) {
+                            }
+                        }
+
+                        private void logFramePayload(final String prefix, final RawFrame frame) {
+                            try {
+                                final LogAppendable logAppendable = new LogAppendable(framePayloadLog, prefix);
+                                framePrinter.printPayload(frame, logAppendable);
+                                logAppendable.flush();
+                            } catch (IOException ignore) {
+                            }
+                        }
+
+                        private void logFlowControl(final String prefix, final int streamId, final int delta, final int actualSize) {
+                            final StringBuilder buffer = new StringBuilder();
+                            buffer.append(prefix).append(" stream ").append(streamId).append(" flow control " )
+                                    .append(delta).append(" -> ")
+                                    .append(actualSize);
+                            flowCtrlLog.debug(buffer.toString());
+                        }
+
+                        @Override
+                        public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
+                            if (headerLog.isDebugEnabled()) {
+                                for (int i = 0; i < headers.size(); i++) {
+                                    headerLog.debug(id + " << " + headers.get(i));
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
+                            if (headerLog.isDebugEnabled()) {
+                                for (int i = 0; i < headers.size(); i++) {
+                                    headerLog.debug(id + " >> " + headers.get(i));
+                                }
+                            }
+                        }
+
+                        @Override
+                        public void onFrameInput(final HttpConnection connection, final int streamId, final RawFrame frame) {
+                            if (frameLog.isDebugEnabled()) {
+                                logFrameInfo(id + " <<", frame);
+                            }
+                            if (framePayloadLog.isDebugEnabled()) {
+                                logFramePayload(id + " <<", frame);
+                            }
+                        }
+
+                        @Override
+                        public void onFrameOutput(final HttpConnection connection, final int streamId, final RawFrame frame) {
+                            if (frameLog.isDebugEnabled()) {
+                                logFrameInfo(id + " >>", frame);
+                            }
+                            if (framePayloadLog.isDebugEnabled()) {
+                                logFramePayload(id + " >>", frame);
+                            }
+                        }
+
+                        @Override
+                        public void onInputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) {
+                            if (flowCtrlLog.isDebugEnabled()) {
+                                logFlowControl(id + " <<", streamId, delta, actualSize);
+                            }
+                        }
+
+                        @Override
+                        public void onOutputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) {
+                            if (flowCtrlLog.isDebugEnabled()) {
+                                logFlowControl(id + " >>", streamId, delta, actualSize);
+                            }
+                        }
+
+            }), id, streamLog);
+        } else {
+            return new DefaultAsyncHttpClientProtocolNegotiator(ioSession,
+                    httpProcessor, exchangeHandlerFactory, charset, h2Config, null, null);
+        }
+
+   }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttp2ClientEventHandlerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java (from r1784139, httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java?p2=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java&p1=httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java&r1=1784139&r2=1784140&rev=1784140&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/NoopUserTokenHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java Thu Feb 23 14:33:47 2017
@@ -24,27 +24,44 @@
  * <http://www.apache.org/>.
  *
  */
-package org.apache.hc.client5.http.impl.sync;
 
-import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.protocol.UserTokenHandler;
+package org.apache.hc.client5.http.impl.async;
+
+import java.nio.charset.Charset;
+
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
-import org.apache.hc.core5.http.protocol.HttpContext;
+import org.apache.hc.core5.http.HttpVersion;
+import org.apache.hc.core5.http.ProtocolVersion;
+import org.apache.hc.core5.http.impl.ConnectionListener;
+import org.apache.hc.core5.http.nio.AsyncPushConsumer;
+import org.apache.hc.core5.http.nio.HandlerFactory;
+import org.apache.hc.core5.http.protocol.HttpProcessor;
+import org.apache.hc.core5.http2.config.H2Config;
+import org.apache.hc.core5.http2.impl.nio.ClientHttpProtocolNegotiator;
+import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
+import org.apache.hc.core5.reactor.IOSession;
 
 /**
- * Noop implementation of {@link UserTokenHandler} that always returns {@code null}.
- *
- * @since 4.3
+ * @since 5.0
  */
 @Contract(threading = ThreadingBehavior.IMMUTABLE)
-public class NoopUserTokenHandler implements UserTokenHandler {
+public class DefaultAsyncHttpClientProtocolNegotiator extends ClientHttpProtocolNegotiator {
 
-    public static final NoopUserTokenHandler INSTANCE = new NoopUserTokenHandler();
+    public DefaultAsyncHttpClientProtocolNegotiator(
+            final IOSession ioSession,
+            final HttpProcessor httpProcessor,
+            final HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
+            final Charset charset,
+            final H2Config h2Config,
+            final ConnectionListener connectionListener,
+            final Http2StreamListener streamListener) {
+        super(ioSession, httpProcessor, pushHandlerFactory, charset, h2Config, connectionListener, streamListener);
+    }
 
     @Override
-    public Object getUserToken(final HttpRoute route, final HttpContext context) {
-        return null;
+    public ProtocolVersion getProtocolVersion() {
+        return HttpVersion.HTTP_2_0;
     }
 
 }

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/DefaultAsyncHttpClientProtocolNegotiator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message