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/05/12 08:04:25 UTC

[01/19] httpcomponents-core git commit: Camel-case lvar name. [Forced Update!]

Repository: httpcomponents-core
Updated Branches:
  refs/heads/4.4.x 6678c9502 -> 672542f81 (forced update)


Camel-case lvar name.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f6d822b6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f6d822b6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f6d822b6

Branch: refs/heads/4.4.x
Commit: f6d822b6485c28b27a79171c928aca287643b4dc
Parents: 1cce7dc
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon Apr 24 21:39:36 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:14:41 2017 +0200

----------------------------------------------------------------------
 .../apache/http/protocol/RequestTargetHost.java    | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f6d822b6/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
index 8221786..54e7473 100644
--- a/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
+++ b/httpcore/src/main/java/org/apache/http/protocol/RequestTargetHost.java
@@ -61,7 +61,7 @@ public class RequestTargetHost implements HttpRequestInterceptor {
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
 
-        final HttpCoreContext corecontext = HttpCoreContext.adapt(context);
+        final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
 
         final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
         final String method = request.getRequestLine().getMethod();
@@ -70,27 +70,26 @@ public class RequestTargetHost implements HttpRequestInterceptor {
         }
 
         if (!request.containsHeader(HTTP.TARGET_HOST)) {
-            HttpHost targethost = corecontext.getTargetHost();
-            if (targethost == null) {
-                final HttpConnection conn = corecontext.getConnection();
+            HttpHost targetHost = coreContext.getTargetHost();
+            if (targetHost == null) {
+                final HttpConnection conn = coreContext.getConnection();
                 if (conn instanceof HttpInetConnection) {
                     // Populate the context with a default HTTP host based on the
                     // inet address of the target host
                     final InetAddress address = ((HttpInetConnection) conn).getRemoteAddress();
                     final int port = ((HttpInetConnection) conn).getRemotePort();
                     if (address != null) {
-                        targethost = new HttpHost(address.getHostName(), port);
+                        targetHost = new HttpHost(address.getHostName(), port);
                     }
                 }
-                if (targethost == null) {
+                if (targetHost == null) {
                     if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
                         return;
-                    } else {
-                        throw new ProtocolException("Target host missing");
                     }
+                    throw new ProtocolException("Target host missing");
                 }
             }
-            request.addHeader(HTTP.TARGET_HOST, targethost.toHostString());
+            request.addHeader(HTTP.TARGET_HOST, targetHost.toHostString());
         }
     }
 


[11/19] httpcomponents-core git commit: HTTPCORE-463: Fixed incorrect use of connect timeout setting in AbstractNIOConnPool

Posted by ol...@apache.org.
HTTPCORE-463: Fixed incorrect use of connect timeout setting in AbstractNIOConnPool

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794129 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/0cc398f5
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/0cc398f5
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/0cc398f5

Branch: refs/heads/4.4.x
Commit: 0cc398f50136e272fa71717df8e8a8b12cccaf38
Parents: 51128f6
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat May 6 09:07:54 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:50:04 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/nio/pool/AbstractNIOConnPool.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0cc398f5/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
index 77824b4..3025fac 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
@@ -272,8 +272,10 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
         final BasicFuture<E> future = new BasicFuture<E>(callback);
         this.lock.lock();
         try {
-            final long timeout = connectTimeout > 0 ? tunit.toMillis(connectTimeout) : 0;
-            final LeaseRequest<T, C, E> request = new LeaseRequest<T, C, E>(route, state, timeout, leaseTimeout, future);
+            final LeaseRequest<T, C, E> request = new LeaseRequest<T, C, E>(route, state,
+                    connectTimeout >= 0 ? tunit.toMillis(connectTimeout) : -1,
+                    leaseTimeout > 0 ? tunit.toMillis(leaseTimeout) : 0,
+                    future);
             final boolean completed = processPendingRequest(request);
             if (!request.isDone() && !completed) {
                 this.leasingRequests.add(request);
@@ -444,9 +446,10 @@ public abstract class AbstractNIOConnPool<T, C, E extends PoolEntry<T, C>>
 
             final SessionRequest sessionRequest = this.ioreactor.connect(
                     remoteAddress, localAddress, route, this.sessionRequestCallback);
-            final int timout = request.getConnectTimeout() < Integer.MAX_VALUE ?
-                    (int) request.getConnectTimeout() : Integer.MAX_VALUE;
-            sessionRequest.setConnectTimeout(timout);
+            final long connectTimeout = request.getConnectTimeout();
+            if (connectTimeout >= 0) {
+                sessionRequest.setConnectTimeout(connectTimeout < Integer.MAX_VALUE ? (int) connectTimeout : Integer.MAX_VALUE);
+            }
             this.pending.add(sessionRequest);
             pool.addPending(sessionRequest, request.getFuture());
             return true;


[17/19] httpcomponents-core git commit: Add toString() for debugging and logging.

Posted by ol...@apache.org.
Add toString() for debugging and logging.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794645 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/75e1623f
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/75e1623f
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/75e1623f

Branch: refs/heads/4.4.x
Commit: 75e1623fbe9475db27ed05ab80c5b96a4a3d366d
Parents: 291d6e3
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 22:05:41 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:58:42 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/impl/nio/reactor/ListenerEndpointImpl.java | 6 ++++++
 .../src/main/java/org/apache/http/params/BasicHttpParams.java  | 5 +++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/75e1623f/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ListenerEndpointImpl.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ListenerEndpointImpl.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ListenerEndpointImpl.java
index 80a9267..34711a0 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ListenerEndpointImpl.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ListenerEndpointImpl.java
@@ -156,4 +156,10 @@ public class ListenerEndpointImpl implements ListenerEndpoint {
         }
     }
 
+    @Override
+    public String toString() {
+        return "[address=" + address + ", key=" + key + ", closed=" + closed + ", completed="
+                + completed + ", exception=" + exception + ", callback=" + callback + "]";
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/75e1623f/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java b/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
index 115171e..18655ad 100644
--- a/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
+++ b/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
@@ -192,4 +192,9 @@ public class BasicHttpParams extends AbstractHttpParams implements Serializable,
     public Set<String> getNames() {
         return new HashSet<String>(this.parameters.keySet());
     }
+
+    @Override
+    public String toString() {
+        return "[parameters=" + parameters + "]";
+    }
 }


[08/19] httpcomponents-core git commit: [HTTPCORE-450] Add a Provider parameter in SSLContextBuilder. Add SSLContextBuilder.setProvider(String).

Posted by ol...@apache.org.
[HTTPCORE-450] Add a Provider parameter in SSLContextBuilder. Add SSLContextBuilder.setProvider(String).

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793914 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/1201300e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/1201300e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/1201300e

Branch: refs/heads/4.4.x
Commit: 1201300ebc6bd2ca9a58585d9d4cd57ef7548c80
Parents: 5ed14a7
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:30:05 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:48:14 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/http/ssl/SSLContextBuilder.java     |  6 ++++++
 .../java/org/apache/http/ssl/TestSSLContextBuilder.java | 12 ++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/1201300e/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 87c5470..70ed1f4 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -41,6 +41,7 @@ import java.security.Principal;
 import java.security.PrivateKey;
 import java.security.Provider;
 import java.security.SecureRandom;
+import java.security.Security;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
@@ -122,6 +123,11 @@ public class SSLContextBuilder {
         return this;
     }
 
+    public SSLContextBuilder setProvider(final String name) {
+        this.provider = Security.getProvider(name);
+        return this;
+    }
+
     public SSLContextBuilder loadTrustMaterial(
             final KeyStore truststore,
             final TrustStrategy trustStrategy) throws NoSuchAlgorithmException, KeyStoreException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/1201300e/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index ae132f0..b789fcf 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -631,4 +631,16 @@ public class TestSSLContextBuilder {
         Assert.assertTrue(sslContext.getProvider().getName().equals("SunJSSE"));
     }
 
+    @Test
+    public void testBuildWithProviderName() throws Exception {
+        final URL resource1 = getClass().getResource("/test-server.keystore");
+        final String storePassword = "nopassword";
+        final String keyPassword = "nopassword";
+        final SSLContext sslContext=SSLContextBuilder.create()
+                .setProvider("SunJSSE")
+                .loadKeyMaterial(resource1, storePassword.toCharArray(), keyPassword.toCharArray())
+                .build();
+        Assert.assertTrue(sslContext.getProvider().getName().equals("SunJSSE"));
+    }
+
 }


[02/19] httpcomponents-core git commit: Javadocs.

Posted by ol...@apache.org.
Javadocs.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793820 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/3cc3cffa
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/3cc3cffa
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/3cc3cffa

Branch: refs/heads/4.4.x
Commit: 3cc3cffaedc16be81c358abe822c851656db5031
Parents: d32e38d
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 15:11:49 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:14:53 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/http/ssl/SSLContextBuilder.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/3cc3cffa/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 2fe30b9..22ded79 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -93,6 +93,20 @@ public class SSLContextBuilder {
         this.trustmanagers = new LinkedHashSet<TrustManager>();
     }
 
+    /**
+     * Sets the SSLContext algorithm name.
+     * 
+     * @param protocol
+     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext section in the <a href=
+     *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *            Cryptography Architecture Standard Algorithm Name
+     *            Documentation</a> for more information.
+     * @return this builder
+     * @see <a href=
+     *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     */
     public SSLContextBuilder useProtocol(final String protocol) {
         this.protocol = protocol;
         return this;


[03/19] httpcomponents-core git commit: Fix parmeter names.

Posted by ol...@apache.org.
Fix parmeter names.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793755 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d32e38df
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d32e38df
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d32e38df

Branch: refs/heads/4.4.x
Commit: d32e38df33829d7845de22787e200584126eb21b
Parents: 605f0bb
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 08:54:07 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:14:53 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/nio/reactor/ssl/SSLSetupHandler.java  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d32e38df/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
index e2afbd8..4724fc4 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
@@ -46,11 +46,11 @@ public interface SSLSetupHandler {
      * can use this callback to customize properties of the {@link SSLEngine}
      * used to establish the SSL session.
      *
-     * @param sslengine the SSL engine.
+     * @param sslEngine the SSL engine.
      * @throws SSLException if case of SSL protocol error.
      */
     //FIXME: fix type
-    void initalize(SSLEngine sslengine) throws SSLException;
+    void initalize(SSLEngine sslEngine) throws SSLException;
 
     /**
      * Triggered when the SSL connection has been established and initial SSL
@@ -59,10 +59,10 @@ public interface SSLSetupHandler {
      * For instance this would be the right place to enforce SSL cipher
      * strength, validate certificate chain and do hostname checks.
      *
-     * @param iosession the underlying IOSession for the SSL connection.
-     * @param sslsession newly created SSL session.
+     * @param ioSession the underlying IOSession for the SSL connection.
+     * @param sslSession newly created SSL session.
      * @throws SSLException if case of SSL protocol error.
      */
-    void verify(IOSession iosession, SSLSession sslsession) throws SSLException;
+    void verify(IOSession ioSession, SSLSession sslSession) throws SSLException;
 
 }


[19/19] httpcomponents-core git commit: HTTPCORE-465: Update example NHttpReverseProxy to support SSL to origin servers which use self-signed certificates.

Posted by ol...@apache.org.
HTTPCORE-465: Update example NHttpReverseProxy to support SSL to origin servers which use self-signed certificates.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/672542f8
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/672542f8
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/672542f8

Branch: refs/heads/4.4.x
Commit: 672542f819cb172dd87c10d08ff930bcecb3cefc
Parents: f5ad120
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 21:45:10 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 10:01:27 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 ++
 .../http/examples/nio/NHttpReverseProxy.java    | 49 ++++++++++++++------
 2 files changed, 38 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/672542f8/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 21409ad..95d3ac0 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -21,6 +21,9 @@ Changelog
 * HTTPCORE-464: org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-465: Update example NHttpReverseProxy to support SSL to origin servers which use self-signed certificates.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/672542f8/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
index 6d9f292..3e04f5b 100644
--- a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
+++ b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java
@@ -31,9 +31,13 @@ import java.io.InterruptedIOException;
 import java.net.InetSocketAddress;
 import java.net.URI;
 import java.nio.ByteBuffer;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
 import java.util.Locale;
 import java.util.concurrent.atomic.AtomicLong;
 
+import javax.net.ssl.SSLContext;
+
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
@@ -50,6 +54,9 @@ import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.EnglishReasonPhraseCatalog;
 import org.apache.http.impl.nio.DefaultHttpClientIODispatch;
 import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
+import org.apache.http.impl.nio.DefaultNHttpClientConnectionFactory;
+import org.apache.http.impl.nio.SSLNHttpClientConnectionFactory;
+import org.apache.http.impl.nio.pool.BasicNIOConnFactory;
 import org.apache.http.impl.nio.pool.BasicNIOConnPool;
 import org.apache.http.impl.nio.pool.BasicNIOPoolEntry;
 import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
@@ -95,21 +102,37 @@ import org.apache.http.protocol.ResponseConnControl;
 import org.apache.http.protocol.ResponseContent;
 import org.apache.http.protocol.ResponseDate;
 import org.apache.http.protocol.ResponseServer;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.ssl.TrustStrategy;
 
 /**
  * Asynchronous, fully streaming HTTP/1.1 reverse proxy.
+ * <p>
+ * Supports SSL to origin servers which use self-signed certificates.
+ * </p>
  */
 public class NHttpReverseProxy {
 
     public static void main(String[] args) throws Exception {
-        if (args.length < 1) {
-            System.out.println("Usage: NHttpReverseProxy <hostname> [port]");
+        if (args.length < 2) {
+            System.out.println("Usage: NHttpReverseProxy <HostNameURI> <Port> [\"TrustSelfSignedStrategy\"]");
             System.exit(1);
         }
+        // Extract command line arguments
         URI uri = new URI(args[0]);
-        int port = 8080;
-        if (args.length > 1) {
-            port = Integer.parseInt(args[1]);
+        int port = Integer.parseInt(args[1]);
+        SSLContext sslContext = null;
+        if (args.length > 2 && args[2].equals("TrustSelfSignedStrategy")) {
+            System.out.println("Using TrustSelfSignedStrategy (not for production)");
+            sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustStrategy() {
+
+                @Override
+                public boolean isTrusted(
+                final X509Certificate[] chain, final String authType) throws CertificateException {
+                    return chain.length == 1;
+                }
+
+            }).build();
         }
 
         // Target host
@@ -151,7 +174,11 @@ public class NHttpReverseProxy {
         HttpAsyncRequester executor = new HttpAsyncRequester(
                 outhttpproc, new ProxyOutgoingConnectionReuseStrategy());
 
-        ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor, ConnectionConfig.DEFAULT);
+        // Without SSL: ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor, ConnectionConfig.DEFAULT);
+        ProxyConnPool connPool = new ProxyConnPool(connectingIOReactor,
+                new BasicNIOConnFactory(new DefaultNHttpClientConnectionFactory(ConnectionConfig.DEFAULT),
+                        new SSLNHttpClientConnectionFactory(sslContext, null, ConnectionConfig.DEFAULT)),
+                0);
         connPool.setMaxTotal(100);
         connPool.setDefaultMaxPerRoute(20);
 
@@ -163,8 +190,8 @@ public class NHttpReverseProxy {
                 new ProxyIncomingConnectionReuseStrategy(),
                 handlerRegistry);
 
-        final IOEventDispatch connectingEventDispatch = new DefaultHttpClientIODispatch(
-                clientHandler, ConnectionConfig.DEFAULT);
+        final IOEventDispatch connectingEventDispatch = DefaultHttpClientIODispatch.create(
+                clientHandler, sslContext, ConnectionConfig.DEFAULT);
 
         final IOEventDispatch listeningEventDispatch = new DefaultHttpServerIODispatch(
                 serviceHandler, ConnectionConfig.DEFAULT);
@@ -845,12 +872,6 @@ public class NHttpReverseProxy {
 
         public ProxyConnPool(
                 final ConnectingIOReactor ioreactor,
-                final ConnectionConfig config) {
-            super(ioreactor, config);
-        }
-
-        public ProxyConnPool(
-                final ConnectingIOReactor ioreactor,
                 final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory,
                 final int connectTimeout) {
             super(ioreactor, connFactory, connectTimeout);


[18/19] httpcomponents-core git commit: Log that we loading the keystore and what we are serving where.

Posted by ol...@apache.org.
Log that we loading the keystore and what we are serving where.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f5ad120f
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f5ad120f
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f5ad120f

Branch: refs/heads/4.4.x
Commit: f5ad120f9793bbb4a2bf6e0da5995df7b90eed78
Parents: 75e1623
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 22:11:04 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 10:00:10 2017 +0200

----------------------------------------------------------------------
 .../examples/org/apache/http/examples/nio/NHttpFileServer.java    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f5ad120f/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
index 56dba42..cbbe8a3 100644
--- a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
+++ b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
@@ -83,6 +83,7 @@ public class NHttpFileServer {
                 System.out.println("Keystore not found");
                 System.exit(1);
             }
+            System.out.println("Loading keystore " + url);
             sslContext = SSLContexts.custom()
                     .loadKeyMaterial(url, "nopassword".toCharArray(), "nopassword".toCharArray())
                     .build();
@@ -103,6 +104,8 @@ public class NHttpFileServer {
                 .create();
 
         server.start();
+        System.out.println("Serving " + docRoot + " on " + server.getEndpoint().getAddress()
+                + (sslContext == null ? "" : " with " + sslContext.getProvider() + " " + sslContext.getProtocol()));
         server.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
 
         Runtime.getRuntime().addShutdownHook(new Thread() {


[13/19] httpcomponents-core git commit: [HTTPCORE-464] org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.

Posted by ol...@apache.org.
[HTTPCORE-464] org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794222 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/36cc72f2
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/36cc72f2
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/36cc72f2

Branch: refs/heads/4.4.x
Commit: 36cc72f2d98a6867773345034be117e0ea49bbf4
Parents: 1d9dff9
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sun May 7 16:45:59 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:51:07 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                                 | 3 +++
 .../main/java/org/apache/http/nio/protocol/HttpAsyncService.java  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/36cc72f2/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index b29e546..21409ad 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -18,6 +18,9 @@ Changelog
 * HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-464: org.apache.http.nio.protocol.HttpAsyncService does not always log exceptions.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/36cc72f2/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
index d8a783d..f941399 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
@@ -277,10 +277,10 @@ public class HttpAsyncService implements NHttpServerEventHandler {
     @Override
     public void exception(
             final NHttpServerConnection conn, final Exception cause) {
+        log(cause);
         final State state = getState(conn);
         if (state == null) {
             shutdownConnection(conn);
-            log(cause);
             return;
         }
         state.setTerminated();


[04/19] httpcomponents-core git commit: Replace @exception with the more modern @throws.

Posted by ol...@apache.org.
Replace @exception with the more modern @throws.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1792678 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/605f0bbe
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/605f0bbe
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/605f0bbe

Branch: refs/heads/4.4.x
Commit: 605f0bbe9525931284f4e8b806bba88e8fb4086e
Parents: f6d822b
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Apr 25 22:57:48 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:14:53 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/nio/util/ContentInputBuffer.java    |  2 +-
 .../org/apache/http/nio/util/ContentOutputBuffer.java   |  6 +++---
 .../apache/http/impl/io/AbstractSessionInputBuffer.java |  4 ++--
 .../http/impl/io/AbstractSessionOutputBuffer.java       |  4 ++--
 .../org/apache/http/impl/io/SessionInputBufferImpl.java |  4 ++--
 .../apache/http/impl/io/SessionOutputBufferImpl.java    |  4 ++--
 .../java/org/apache/http/io/SessionInputBuffer.java     | 12 ++++++------
 .../java/org/apache/http/io/SessionOutputBuffer.java    | 12 ++++++------
 .../main/java/org/apache/http/util/CharArrayBuffer.java |  4 ++--
 9 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
index dc4608f..3ec778f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
@@ -75,7 +75,7 @@ public interface ContentInputBuffer {
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read(byte[] b, int off, int len) throws IOException;
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
index 8a7dae4..9fd151c 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
@@ -73,7 +73,7 @@ public interface ContentOutputBuffer {
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(byte[] b, int off, int len) throws IOException;
 
@@ -81,13 +81,13 @@ public interface ContentOutputBuffer {
      * Writes the specified byte to this buffer.
      *
      * @param      b   the {@code byte}.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(int b) throws IOException;
 
     /**
      * Indicates the content has been fully written.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void writeCompleted() throws IOException;
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
index 7a33671..6ce8018 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
@@ -248,7 +248,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
      *
      * @param      charbuffer   the line buffer.
      * @return     one line of characters
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public int readLine(final CharArrayBuffer charbuffer) throws IOException {
@@ -302,7 +302,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
      * to CR-LF required by the HTTP specification.
      *
      * @return HTTP line as a string
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
             throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
index aba72ea..38c14de 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
@@ -218,7 +218,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
      * This method uses CR-LF as a line delimiter.
      *
      * @param      s   the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final String s) throws IOException {
@@ -245,7 +245,7 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
      * This method uses CR-LF as a line delimiter.
      *
      * @param      charbuffer the buffer containing chars of the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final CharArrayBuffer charbuffer) throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java b/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
index 44d1da5..33d20f1 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
@@ -236,7 +236,7 @@ public class SessionInputBufferImpl implements SessionInputBuffer, BufferInfo {
      *
      * @param      charbuffer   the line buffer.
      * @return     one line of characters
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public int readLine(final CharArrayBuffer charbuffer) throws IOException {
@@ -303,7 +303,7 @@ public class SessionInputBufferImpl implements SessionInputBuffer, BufferInfo {
      * to CR-LF required by the HTTP specification.
      *
      * @return HTTP line as a string
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
             throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java b/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
index efa5a2f..3ed5206 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java
@@ -199,7 +199,7 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer, BufferInfo
      * This method uses CR-LF as a line delimiter.
      *
      * @param      s   the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final String s) throws IOException {
@@ -226,7 +226,7 @@ public class SessionOutputBufferImpl implements SessionOutputBuffer, BufferInfo
      * This method uses CR-LF as a line delimiter.
      *
      * @param      charbuffer the buffer containing chars of the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     @Override
     public void writeLine(final CharArrayBuffer charbuffer) throws IOException {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java b/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
index c3b3a22..ba0f4a9 100644
--- a/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/io/SessionInputBuffer.java
@@ -63,7 +63,7 @@ public interface SessionInputBuffer {
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} if there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read(byte[] b, int off, int len) throws IOException;
 
@@ -77,7 +77,7 @@ public interface SessionInputBuffer {
      * @return     the total number of bytes read into the buffer, or
      *             {@code -1} is there is no more data because the end of
      *             the stream has been reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read(byte[] b) throws IOException;
 
@@ -91,7 +91,7 @@ public interface SessionInputBuffer {
      *
      * @return     the next byte of data, or {@code -1} if the end of the
      *             stream is reached.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int read() throws IOException;
 
@@ -108,7 +108,7 @@ public interface SessionInputBuffer {
      *
      * @param      buffer   the line buffer.
      * @return     one line of characters
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     int readLine(CharArrayBuffer buffer) throws IOException;
 
@@ -123,7 +123,7 @@ public interface SessionInputBuffer {
      * specific implementations of this interface.
      *
      * @return HTTP line as a string
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     String readLine() throws IOException;
 
@@ -134,7 +134,7 @@ public interface SessionInputBuffer {
      * @param timeout in milliseconds.
      * @return {@code true} if some data is available in the session
      *   buffer or {@code false} otherwise.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      *
      * @deprecated (4.3) do not use. This function should be provided at the
      *   connection level

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java b/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
index 40ae69e..666762a 100644
--- a/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/io/SessionOutputBuffer.java
@@ -53,7 +53,7 @@ public interface SessionOutputBuffer {
      * @param      b     the data.
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(byte[] b, int off, int len) throws IOException;
 
@@ -62,7 +62,7 @@ public interface SessionOutputBuffer {
      * to this session buffer.
      *
      * @param      b   the data.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(byte[] b) throws IOException;
 
@@ -70,7 +70,7 @@ public interface SessionOutputBuffer {
      * Writes the specified byte to this session buffer.
      *
      * @param      b   the {@code byte}.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void write(int b) throws IOException;
 
@@ -82,7 +82,7 @@ public interface SessionOutputBuffer {
      * specific implementations of this interface.
      *
      * @param      s   the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void writeLine(String s) throws IOException;
 
@@ -94,7 +94,7 @@ public interface SessionOutputBuffer {
      * specific implementations of this interface.
      *
      * @param      buffer   the buffer containing chars of the line.
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void writeLine(CharArrayBuffer buffer) throws IOException;
 
@@ -106,7 +106,7 @@ public interface SessionOutputBuffer {
      * stream, such bytes should immediately be written to their
      * intended destination.
      *
-     * @exception  IOException  if an I/O error occurs.
+     * @throws  IOException  if an I/O error occurs.
      */
     void flush() throws IOException;
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/605f0bbe/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java b/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
index 36c4d75..a97a373 100644
--- a/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
@@ -410,7 +410,7 @@ public final class CharArrayBuffer implements CharSequence, Serializable {
      * @param      beginIndex   the beginning index, inclusive.
      * @param      endIndex     the ending index, exclusive.
      * @return     the specified substring.
-     * @exception  StringIndexOutOfBoundsException  if the
+     * @throws  StringIndexOutOfBoundsException  if the
      *             {@code beginIndex} is negative, or
      *             {@code endIndex} is larger than the length of this
      *             buffer, or {@code beginIndex} is larger than
@@ -439,7 +439,7 @@ public final class CharArrayBuffer implements CharSequence, Serializable {
      * @param      beginIndex   the beginning index, inclusive.
      * @param      endIndex     the ending index, exclusive.
      * @return     the specified substring.
-     * @exception  IndexOutOfBoundsException  if the
+     * @throws  IndexOutOfBoundsException  if the
      *             {@code beginIndex} is negative, or
      *             {@code endIndex} is larger than the length of this
      *             buffer, or {@code beginIndex} is larger than


[05/19] httpcomponents-core git commit: Rename variables "sslcontext" to "sslContext".

Posted by ol...@apache.org.
Rename variables "sslcontext" to "sslContext".


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5ed14a72
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5ed14a72
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5ed14a72

Branch: refs/heads/4.4.x
Commit: 5ed14a72996e1b4b545f2f52a59517cca8964f7e
Parents: 3cc3cff
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 17:44:37 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:46:26 2017 +0200

----------------------------------------------------------------------
 .../http/examples/nio/NHttpFileServer.java      |  6 ++--
 .../http/impl/nio/SSLClientIOEventDispatch.java | 20 ++++++------
 .../http/impl/nio/SSLServerIOEventDispatch.java | 20 ++++++------
 .../impl/nio/reactor/SSLIOSessionHandler.java   |  2 +-
 .../http/impl/nio/reactor/SSLSetupHandler.java  |  2 +-
 .../impl/nio/ssl/SSLClientIOEventDispatch.java  | 24 +++++++--------
 .../impl/nio/ssl/SSLServerIOEventDispatch.java  | 24 +++++++--------
 .../impl/nio/DefaultHttpClientIODispatch.java   | 16 +++++-----
 .../impl/nio/DefaultHttpServerIODispatch.java   | 16 +++++-----
 .../apache/http/impl/nio/SSLContextUtils.java   | 10 +++---
 .../nio/SSLNHttpClientConnectionFactory.java    | 32 ++++++++++----------
 .../nio/SSLNHttpServerConnectionFactory.java    | 32 ++++++++++----------
 .../http/impl/nio/pool/BasicNIOConnFactory.java | 16 +++++-----
 .../http/nio/reactor/ssl/SSLIOSession.java      |  6 ++--
 .../http/nio/reactor/ssl/SSLSetupHandler.java   |  2 +-
 .../nio/testserver/ClientConnectionFactory.java | 14 ++++-----
 .../nio/testserver/ServerConnectionFactory.java | 14 ++++-----
 .../apache/http/examples/HttpFileServer.java    |  6 ++--
 .../org/apache/http/ssl/SSLContextBuilder.java  | 16 +++++-----
 .../java/org/apache/http/ssl/SSLContexts.java   |  6 ++--
 20 files changed, 142 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
index c8bb1a2..612c02e 100644
--- a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
+++ b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
@@ -75,7 +75,7 @@ public class NHttpFileServer {
             port = Integer.parseInt(args[1]);
         }
 
-        SSLContext sslcontext = null;
+        SSLContext sslContext = null;
         if (port == 8443) {
             // Initialize SSL context
             URL url = NHttpFileServer.class.getResource("/my.keystore");
@@ -83,7 +83,7 @@ public class NHttpFileServer {
                 System.out.println("Keystore not found");
                 System.exit(1);
             }
-            sslcontext = SSLContexts.custom()
+            sslContext = SSLContexts.custom()
                     .loadKeyMaterial(url, "secret".toCharArray(), "secret".toCharArray())
                     .build();
         }
@@ -97,7 +97,7 @@ public class NHttpFileServer {
                 .setListenerPort(port)
                 .setServerInfo("Test/1.1")
                 .setIOReactorConfig(config)
-                .setSslContext(sslcontext)
+                .setSslContext(sslContext)
                 .setExceptionLogger(ExceptionLogger.STD_ERR)
                 .registerHandler("*", new HttpFileHandler(docRoot))
                 .create();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
index 741b374..852f246 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLClientIOEventDispatch.java
@@ -72,22 +72,22 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler,
             final HttpParams params) {
         super();
         Args.notNull(handler, "HTTP client handler");
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
         this.handler = handler;
         this.params = params;
-        this.sslcontext = sslcontext;
+        this.sslcontext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -98,14 +98,14 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -162,15 +162,15 @@ public class SSLClientIOEventDispatch implements IOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
index 38f5af6..1e901dc 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/SSLServerIOEventDispatch.java
@@ -72,22 +72,22 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler,
             final HttpParams params) {
         super();
         Args.notNull(handler, "HTTP service handler");
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
         this.handler = handler;
         this.params = params;
-        this.sslcontext = sslcontext;
+        this.sslcontext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -98,14 +98,14 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -162,15 +162,15 @@ public class SSLServerIOEventDispatch implements IOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLIOSessionHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
index 518939b..a0b464a 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLIOSessionHandler.java
@@ -37,7 +37,7 @@ import org.apache.http.params.HttpParams;
 
 /**
  * Callback interface that can be used to customize various aspects of
- * the TLS/SSl protocol.
+ * the TLS/SSL protocol.
  *
  * @since 4.0
  *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
index d68e4b2..fc867a7 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/reactor/SSLSetupHandler.java
@@ -36,7 +36,7 @@ import org.apache.http.params.HttpParams;
 
 /**
  * Callback interface that can be used to customize various aspects of
- * the TLS/SSl protocol.
+ * the TLS/SSL protocol.
  *
  * @since 4.1
  *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
index 578f54a..d7d87ab 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLClientIOEventDispatch.java
@@ -51,7 +51,7 @@ import org.apache.http.util.Args;
 @Deprecated
 public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
 
     /**
@@ -61,19 +61,19 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
         super(handler, params);
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -84,14 +84,14 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the client protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLClientIOEventDispatch(
             final NHttpClientHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -102,15 +102,15 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     protected NHttpClientIOTarget createSSLConnection(final SSLIOSession ssliosession) {
@@ -119,7 +119,7 @@ public class SSLClientIOEventDispatch extends DefaultClientIOEventDispatch {
 
     @Override
     protected NHttpClientIOTarget createConnection(final IOSession session) {
-        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslContext, this.sslHandler);
         session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         final NHttpClientIOTarget conn = createSSLConnection(ssliosession);
         try {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
index c3a4c37..cf1d413 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/impl/nio/ssl/SSLServerIOEventDispatch.java
@@ -51,7 +51,7 @@ import org.apache.http.util.Args;
 @Deprecated
 public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
 
     /**
@@ -61,19 +61,19 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
         super(handler, params);
-        Args.notNull(sslcontext, "SSL context");
+        Args.notNull(sslContext, "SSL context");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.sslHandler = sslHandler;
     }
 
@@ -84,14 +84,14 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
      * protocol aspects for HTTP connections.
      *
      * @param handler the server protocol handler.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param params HTTP parameters.
      */
     public SSLServerIOEventDispatch(
             final NHttpServiceHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -102,15 +102,15 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
      * a different implementation of SSL I/O session.
      *
      * @param session the underlying I/O session.
-     * @param sslcontext the SSL context.
+     * @param sslContext the SSL context.
      * @param sslHandler the SSL setup handler.
      * @return newly created SSL I/O session.
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession session,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
-        return new SSLIOSession(session, sslcontext, sslHandler);
+        return new SSLIOSession(session, sslContext, sslHandler);
     }
 
     protected NHttpServerIOTarget createSSLConnection(final SSLIOSession ssliosession) {
@@ -119,7 +119,7 @@ public class SSLServerIOEventDispatch extends DefaultServerIOEventDispatch {
 
     @Override
     protected NHttpServerIOTarget createConnection(final IOSession session) {
-        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(session, this.sslContext, this.sslHandler);
         session.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         final NHttpServerIOTarget conn = createSSLConnection(ssliosession);
         try {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
index e62ccdf..cfc0a10 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
@@ -90,10 +90,10 @@ public class DefaultHttpClientIODispatch
     @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, params));
+        this(handler, new SSLNHttpClientConnectionFactory(sslContext, sslHandler, params));
     }
 
     /**
@@ -103,9 +103,9 @@ public class DefaultHttpClientIODispatch
     @Deprecated
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -120,10 +120,10 @@ public class DefaultHttpClientIODispatch
      */
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, sslHandler, config));
+        this(handler, new SSLNHttpClientConnectionFactory(sslContext, sslHandler, config));
     }
 
     /**
@@ -131,9 +131,9 @@ public class DefaultHttpClientIODispatch
      */
     public DefaultHttpClientIODispatch(
             final NHttpClientEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpClientConnectionFactory(sslcontext, null, config));
+        this(handler, new SSLNHttpClientConnectionFactory(sslContext, null, config));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
index e109b64..a49b1b3 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
@@ -83,10 +83,10 @@ public class DefaultHttpServerIODispatch
     @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler, params));
+        this(handler, new SSLNHttpServerConnectionFactory(sslContext, sslHandler, params));
     }
 
     /**
@@ -96,9 +96,9 @@ public class DefaultHttpServerIODispatch
     @Deprecated
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final HttpParams params) {
-        this(handler, sslcontext, null, params);
+        this(handler, sslContext, null, params);
     }
 
     /**
@@ -113,10 +113,10 @@ public class DefaultHttpServerIODispatch
      */
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, sslHandler, config));
+        this(handler, new SSLNHttpServerConnectionFactory(sslContext, sslHandler, config));
     }
 
     /**
@@ -124,9 +124,9 @@ public class DefaultHttpServerIODispatch
      */
     public DefaultHttpServerIODispatch(
             final NHttpServerEventHandler handler,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final ConnectionConfig config) {
-        this(handler, new SSLNHttpServerConnectionFactory(sslcontext, null, config));
+        this(handler, new SSLNHttpServerConnectionFactory(sslContext, null, config));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
index fea5a4e..079a31f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLContextUtils.java
@@ -33,18 +33,18 @@ import java.security.NoSuchAlgorithmException;
 class SSLContextUtils {
 
     static SSLContext getDefault() {
-        SSLContext sslcontext;
+        SSLContext sslContext;
         try {
             try {
-                sslcontext = SSLContext.getInstance("Default");
+                sslContext = SSLContext.getInstance("Default");
             }  catch (final NoSuchAlgorithmException ex) {
-                sslcontext = SSLContext.getInstance("TLS");
+                sslContext = SSLContext.getInstance("TLS");
             }
-            sslcontext.init(null, null, null);
+            sslContext.init(null, null, null);
         } catch (final Exception ex) {
             throw new IllegalStateException("Failure initializing default SSL context", ex);
         }
-        return sslcontext;
+        return sslContext;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
index 5b28579..6c3af86 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpClientConnectionFactory.java
@@ -70,7 +70,7 @@ public class SSLNHttpClientConnectionFactory
     private final NHttpMessageParserFactory<HttpResponse> responseParserFactory;
     private final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory;
     private final ByteBufferAllocator allocator;
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
     private final ConnectionConfig cconfig;
 
@@ -82,7 +82,7 @@ public class SSLNHttpClientConnectionFactory
      */
     @Deprecated
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpResponseFactory responseFactory,
             final ByteBufferAllocator allocator,
@@ -91,7 +91,7 @@ public class SSLNHttpClientConnectionFactory
         Args.notNull(responseFactory, "HTTP response factory");
         Args.notNull(allocator, "Byte buffer allocator");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.allocator = allocator;
         this.incomingContentStrategy = null;
@@ -108,10 +108,10 @@ public class SSLNHttpClientConnectionFactory
      */
     @Deprecated
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(sslcontext, sslHandler, DefaultHttpResponseFactory.INSTANCE,
+        this(sslContext, sslHandler, DefaultHttpResponseFactory.INSTANCE,
                 HeapByteBufferAllocator.INSTANCE, params);
     }
 
@@ -128,7 +128,7 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ContentLengthStrategy incomingContentStrategy,
             final ContentLengthStrategy outgoingContentStrategy,
@@ -137,7 +137,7 @@ public class SSLNHttpClientConnectionFactory
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
         super();
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.incomingContentStrategy = incomingContentStrategy;
         this.outgoingContentStrategy = outgoingContentStrategy;
@@ -151,13 +151,13 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
             final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, responseParserFactory, requestWriterFactory, allocator, cconfig);
     }
 
@@ -165,12 +165,12 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
             final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, responseParserFactory, requestWriterFactory, null, cconfig);
     }
 
@@ -178,10 +178,10 @@ public class SSLNHttpClientConnectionFactory
      * @since 4.3
      */
     public SSLNHttpClientConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(sslcontext, sslHandler, null, null, null, null, null, config);
+        this(sslContext, sslHandler, null, null, null, null, null, config);
     }
 
     /**
@@ -215,16 +215,16 @@ public class SSLNHttpClientConnectionFactory
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession iosession,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
         final SSLIOSession ssliosession = new SSLIOSession(iosession, SSLMode.CLIENT,
-                sslcontext, sslHandler);
+                sslContext, sslHandler);
         return ssliosession;
     }
 
     @Override
     public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
-        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslContext, this.sslHandler);
         iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         return new DefaultNHttpClientConnection(
                 ssliosession,

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
index 99576f3..294f8af 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SSLNHttpServerConnectionFactory.java
@@ -63,7 +63,7 @@ import org.apache.http.util.Args;
 public class SSLNHttpServerConnectionFactory
     implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler sslHandler;
     private final ContentLengthStrategy incomingContentStrategy;
     private final ContentLengthStrategy outgoingContentStrategy;
@@ -80,7 +80,7 @@ public class SSLNHttpServerConnectionFactory
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpRequestFactory requestFactory,
             final ByteBufferAllocator allocator,
@@ -89,7 +89,7 @@ public class SSLNHttpServerConnectionFactory
         Args.notNull(requestFactory, "HTTP request factory");
         Args.notNull(allocator, "Byte buffer allocator");
         Args.notNull(params, "HTTP parameters");
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.incomingContentStrategy = null;
         this.outgoingContentStrategy = null;
@@ -106,10 +106,10 @@ public class SSLNHttpServerConnectionFactory
      */
     @Deprecated
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(sslcontext, sslHandler, DefaultHttpRequestFactory.INSTANCE,
+        this(sslContext, sslHandler, DefaultHttpRequestFactory.INSTANCE,
                 HeapByteBufferAllocator.INSTANCE, params);
     }
 
@@ -126,7 +126,7 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ContentLengthStrategy incomingContentStrategy,
             final ContentLengthStrategy outgoingContentStrategy,
@@ -135,7 +135,7 @@ public class SSLNHttpServerConnectionFactory
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
         super();
-        this.sslcontext = sslcontext != null ? sslcontext : SSLContexts.createSystemDefault();
+        this.sslContext = sslContext != null ? sslContext : SSLContexts.createSystemDefault();
         this.sslHandler = sslHandler;
         this.incomingContentStrategy = incomingContentStrategy;
         this.outgoingContentStrategy = outgoingContentStrategy;
@@ -149,13 +149,13 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
             final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory,
             final ByteBufferAllocator allocator,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, requestParserFactory, responseWriterFactory, allocator, cconfig);
     }
 
@@ -163,12 +163,12 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
             final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory,
             final ConnectionConfig cconfig) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 null, null, requestParserFactory, responseWriterFactory, null, cconfig);
     }
 
@@ -176,10 +176,10 @@ public class SSLNHttpServerConnectionFactory
      * @since 4.3
      */
     public SSLNHttpServerConnectionFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(sslcontext, sslHandler, null, null, null, null, null, config);
+        this(sslContext, sslHandler, null, null, null, null, null, config);
     }
 
     /**
@@ -213,16 +213,16 @@ public class SSLNHttpServerConnectionFactory
      */
     protected SSLIOSession createSSLIOSession(
             final IOSession iosession,
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler) {
         final SSLIOSession ssliosession = new SSLIOSession(iosession, SSLMode.SERVER,
-                sslcontext, sslHandler);
+                sslContext, sslHandler);
         return ssliosession;
     }
 
     @Override
     public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
-        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler);
+        final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslContext, this.sslHandler);
         iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
         return new DefaultNHttpServerConnection(ssliosession,
                 this.cconfig.getBufferSize(),

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
index e3bdb7f..274897f 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnFactory.java
@@ -87,7 +87,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      */
     @Deprecated
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpResponseFactory responseFactory,
             final ByteBufferAllocator allocator,
@@ -95,7 +95,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
         this(new DefaultNHttpClientConnectionFactory(
                 responseFactory, allocator, params),
                 new SSLNHttpClientConnectionFactory(
-                        sslcontext, sslHandler, responseFactory, allocator, params));
+                        sslContext, sslHandler, responseFactory, allocator, params));
     }
 
     /**
@@ -104,10 +104,10 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      */
     @Deprecated
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final HttpParams params) {
-        this(sslcontext, sslHandler,
+        this(sslContext, sslHandler,
                 DefaultHttpResponseFactory.INSTANCE, HeapByteBufferAllocator.INSTANCE, params);
     }
 
@@ -123,7 +123,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      * @since 4.3
      */
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final NHttpMessageParserFactory<HttpResponse> responseParserFactory,
             final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
@@ -132,7 +132,7 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
         this(new DefaultNHttpClientConnectionFactory(
                     responseParserFactory, requestWriterFactory, allocator, config),
                 new SSLNHttpClientConnectionFactory(
-                        sslcontext, sslHandler, responseParserFactory, requestWriterFactory,
+                        sslContext, sslHandler, responseParserFactory, requestWriterFactory,
                         allocator, config));
     }
 
@@ -140,10 +140,10 @@ public class BasicNIOConnFactory implements NIOConnFactory<HttpHost, NHttpClient
      * @since 4.3
      */
     public BasicNIOConnFactory(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final SSLSetupHandler sslHandler,
             final ConnectionConfig config) {
-        this(sslcontext, sslHandler, null, null, null, config);
+        this(sslContext, sslHandler, null, null, null, config);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
index e47cf11..68951ad 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
@@ -62,10 +62,10 @@ import org.apache.http.util.Asserts;
  * The resultant instance of {@code SSLIOSession} must be added to the original
  * I/O session as an attribute with the {@link #SESSION_KEY} key.
  * <pre>
- *  SSLContext sslcontext = SSLContext.getInstance("SSL");
- *  sslcontext.init(null, null, null);
+ *  SSLContext sslContext = SSLContext.getInstance("SSL");
+ *  sslContext.init(null, null, null);
  *  SSLIOSession sslsession = new SSLIOSession(
- *      iosession, SSLMode.CLIENT, sslcontext, null);
+ *      iosession, SSLMode.CLIENT, sslContext, null);
  *  iosession.setAttribute(SSLIOSession.SESSION_KEY, sslsession);
  * </pre>
  *

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
index 4724fc4..9c81b74 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLSetupHandler.java
@@ -35,7 +35,7 @@ import org.apache.http.nio.reactor.IOSession;
 
 /**
  * Callback interface that can be used to customize various aspects of
- * the TLS/SSl protocol.
+ * the TLS/SSL protocol.
  *
  * @since 4.2
  */

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
index 22bf4dc..0042772 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
@@ -37,18 +37,18 @@ import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 
 public class ClientConnectionFactory implements NHttpConnectionFactory<DefaultNHttpClientConnection> {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler setupHandler;
 
     public ClientConnectionFactory(
-            final SSLContext sslcontext, final SSLSetupHandler setupHandler) {
+            final SSLContext sslContext, final SSLSetupHandler setupHandler) {
         super();
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.setupHandler = setupHandler;
     }
 
-    public ClientConnectionFactory(final SSLContext sslcontext) {
-        this(sslcontext, null);
+    public ClientConnectionFactory(final SSLContext sslContext) {
+        this(sslContext, null);
     }
 
     public ClientConnectionFactory() {
@@ -57,9 +57,9 @@ public class ClientConnectionFactory implements NHttpConnectionFactory<DefaultNH
 
     @Override
     public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
-        if (this.sslcontext != null) {
+        if (this.sslContext != null) {
             final SSLIOSession ssliosession = new SSLIOSession(
-                    iosession, SSLMode.CLIENT, this.sslcontext, this.setupHandler);
+                    iosession, SSLMode.CLIENT, this.sslContext, this.setupHandler);
             iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
             return new LoggingNHttpClientConnection(ssliosession);
         } else {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
index a64e8ae..4c0b174 100644
--- a/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
+++ b/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
@@ -37,18 +37,18 @@ import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 
 public class ServerConnectionFactory implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
-    private final SSLContext sslcontext;
+    private final SSLContext sslContext;
     private final SSLSetupHandler setupHandler;
 
     public ServerConnectionFactory(
-            final SSLContext sslcontext, final SSLSetupHandler setupHandler) {
+            final SSLContext sslContext, final SSLSetupHandler setupHandler) {
         super();
-        this.sslcontext = sslcontext;
+        this.sslContext = sslContext;
         this.setupHandler = setupHandler;
     }
 
-    public ServerConnectionFactory(final SSLContext sslcontext) {
-        this(sslcontext, null);
+    public ServerConnectionFactory(final SSLContext sslContext) {
+        this(sslContext, null);
     }
 
     public ServerConnectionFactory() {
@@ -57,9 +57,9 @@ public class ServerConnectionFactory implements NHttpConnectionFactory<DefaultNH
 
     @Override
     public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
-        if (this.sslcontext != null) {
+        if (this.sslContext != null) {
             final SSLIOSession ssliosession = new SSLIOSession(
-                    iosession, SSLMode.SERVER, this.sslcontext, this.setupHandler);
+                    iosession, SSLMode.SERVER, this.sslContext, this.setupHandler);
             iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
             return new LoggingNHttpServerConnection(ssliosession);
         } else {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java b/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
index 6dd7af3..4c9c725 100644
--- a/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
+++ b/httpcore/src/examples/org/apache/http/examples/HttpFileServer.java
@@ -77,7 +77,7 @@ public class HttpFileServer {
             port = Integer.parseInt(args[1]);
         }
 
-        SSLContext sslcontext = null;
+        SSLContext sslContext = null;
         if (port == 8443) {
             // Initialize SSL context
             URL url = HttpFileServer.class.getResource("/my.keystore");
@@ -85,7 +85,7 @@ public class HttpFileServer {
                 System.out.println("Keystore not found");
                 System.exit(1);
             }
-            sslcontext = SSLContexts.custom()
+            sslContext = SSLContexts.custom()
                     .loadKeyMaterial(url, "secret".toCharArray(), "secret".toCharArray())
                     .build();
         }
@@ -99,7 +99,7 @@ public class HttpFileServer {
                 .setListenerPort(port)
                 .setServerInfo("Test/1.1")
                 .setSocketConfig(socketConfig)
-                .setSslContext(sslcontext)
+                .setSslContext(sslContext)
                 .setExceptionLogger(new StdErrorExceptionLogger())
                 .registerHandler("*", new HttpFileHandler(docRoot))
                 .create();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 22ded79..87c5470 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -95,7 +95,7 @@ public class SSLContextBuilder {
 
     /**
      * Sets the SSLContext algorithm name.
-     * 
+     *
      * @param protocol
      *            the SSLContext algorithm name of the requested protocol. See
      *            the SSLContext section in the <a href=
@@ -276,26 +276,26 @@ public class SSLContextBuilder {
     }
 
     protected void initSSLContext(
-            final SSLContext sslcontext,
+            final SSLContext sslContext,
             final Collection<KeyManager> keyManagers,
             final Collection<TrustManager> trustManagers,
             final SecureRandom secureRandom) throws KeyManagementException {
-        sslcontext.init(
+        sslContext.init(
                 !keyManagers.isEmpty() ? keyManagers.toArray(new KeyManager[keyManagers.size()]) : null,
                 !trustManagers.isEmpty() ? trustManagers.toArray(new TrustManager[trustManagers.size()]) : null,
                 secureRandom);
     }
 
     public SSLContext build() throws NoSuchAlgorithmException, KeyManagementException {
-        final SSLContext sslcontext;
+        final SSLContext sslContext;
         final String protocolStr = this.protocol != null ? this.protocol : TLS;
         if (this.provider != null) {
-            sslcontext = SSLContext.getInstance(protocolStr, this.provider);
+            sslContext = SSLContext.getInstance(protocolStr, this.provider);
         } else {
-            sslcontext = SSLContext.getInstance(protocolStr);
+            sslContext = SSLContext.getInstance(protocolStr);
         }
-        initSSLContext(sslcontext, keymanagers, trustmanagers, secureRandom);
-        return sslcontext;
+        initSSLContext(sslContext, keymanagers, trustmanagers, secureRandom);
+        return sslContext;
     }
 
     static class TrustManagerDelegate implements X509TrustManager {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5ed14a72/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
index 3c0f35c..19a40df 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContexts.java
@@ -48,9 +48,9 @@ public class SSLContexts {
      */
     public static SSLContext createDefault() throws SSLInitializationException {
         try {
-            final SSLContext sslcontext = SSLContext.getInstance(SSLContextBuilder.TLS);
-            sslcontext.init(null, null, null);
-            return sslcontext;
+            final SSLContext sslContext = SSLContext.getInstance(SSLContextBuilder.TLS);
+            sslContext.init(null, null, null);
+            return sslContext;
         } catch (final NoSuchAlgorithmException ex) {
             throw new SSLInitializationException(ex.getMessage(), ex);
         } catch (final KeyManagementException ex) {


[07/19] httpcomponents-core git commit: HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.

Posted by ol...@apache.org.
HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793918 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/31edd6e6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/31edd6e6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/31edd6e6

Branch: refs/heads/4.4.x
Commit: 31edd6e638b6d8efe9a0a75f3e88298f47d697f4
Parents: 1201300
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:41:22 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:48:14 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 ++
 .../impl/nio/DefaultHttpClientIODispatch.java   | 38 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/31edd6e6/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 46173c4..4a3ea93 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -9,6 +9,9 @@ Changelog
 * HTTPCORE-450: Add a Provider parameter in SSLContextBuilder.
   Contributed by lujianbo <387852424 at qq dot com>, Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/31edd6e6/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
index cfc0a10..44935b0 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpClientIODispatch.java
@@ -31,8 +31,8 @@ import java.io.IOException;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpClientEventHandler;
@@ -54,6 +54,42 @@ import org.apache.http.util.Args;
 public class DefaultHttpClientIODispatch
                     extends AbstractIODispatch<DefaultNHttpClientConnection> {
 
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpClientIODispatch create(final NHttpClientEventHandler handler,
+            final SSLContext sslContext,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpClientIODispatch(handler, config)
+                : new DefaultHttpClientIODispatch(handler, sslContext, config);
+    }
+
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param sslHandler customizes various aspects of the TLS/SSL protocol.
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpClientIODispatch create(final NHttpClientEventHandler handler,
+            final SSLContext sslContext,
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpClientIODispatch(handler, config)
+                : new DefaultHttpClientIODispatch(handler, sslContext, sslHandler, config);
+    }
+
     private final NHttpClientEventHandler handler;
     private final NHttpConnectionFactory<DefaultNHttpClientConnection> connFactory;
 


[15/19] httpcomponents-core git commit: Add org.apache.http.ssl.SSLContextBuilder.toString() for debugging and logging.

Posted by ol...@apache.org.
Add org.apache.http.ssl.SSLContextBuilder.toString() for debugging and logging.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/05bd4af6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/05bd4af6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/05bd4af6

Branch: refs/heads/4.4.x
Commit: 05bd4af6e917e343f5317c4d5761b85a32f1fdc2
Parents: a3c2fbd
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 02:48:30 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:54:21 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/ssl/SSLContextBuilder.java  | 31 +++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/05bd4af6/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 20d9eee..f736adb 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -79,8 +79,8 @@ public class SSLContextBuilder {
     static final String TLS   = "TLS";
 
     private String protocol;
-    private final Set<KeyManager> keymanagers;
-    private final Set<TrustManager> trustmanagers;
+    private final Set<KeyManager> keyManagers;
+    private final Set<TrustManager> trustManagers;
     private SecureRandom secureRandom;
     private Provider provider;
 
@@ -90,15 +90,15 @@ public class SSLContextBuilder {
 
     public SSLContextBuilder() {
         super();
-        this.keymanagers = new LinkedHashSet<KeyManager>();
-        this.trustmanagers = new LinkedHashSet<TrustManager>();
+        this.keyManagers = new LinkedHashSet<KeyManager>();
+        this.trustManagers = new LinkedHashSet<TrustManager>();
     }
 
     /**
-     * Sets the SSLContext algorithm name.
+     * Sets the SSLContext protocol algorithm name.
      *
      * @param protocol
-     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext protocol algorithm name of the requested protocol. See
      *            the SSLContext section in the <a href=
      *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *            Cryptography Architecture Standard Algorithm Name
@@ -116,10 +116,10 @@ public class SSLContextBuilder {
     }
 
     /**
-     * Sets the SSLContext algorithm name.
+     * Sets the SSLContext protocol algorithm name.
      *
      * @param protocol
-     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext protocol algorithm name of the requested protocol. See
      *            the SSLContext section in the <a href=
      *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *            Cryptography Architecture Standard Algorithm Name
@@ -168,7 +168,7 @@ public class SSLContextBuilder {
                 }
             }
             for (final TrustManager tm : tms) {
-                this.trustmanagers.add(tm);
+                this.trustManagers.add(tm);
             }
         }
         return this;
@@ -245,7 +245,7 @@ public class SSLContextBuilder {
                 }
             }
             for (final KeyManager km : kms) {
-                keymanagers.add(km);
+                keyManagers.add(km);
             }
         }
         return this;
@@ -322,7 +322,7 @@ public class SSLContextBuilder {
         } else {
             sslContext = SSLContext.getInstance(protocolStr);
         }
-        initSSLContext(sslContext, keymanagers, trustmanagers, secureRandom);
+        initSSLContext(sslContext, keyManagers, trustManagers, secureRandom);
         return sslContext;
     }
 
@@ -449,4 +449,13 @@ public class SSLContextBuilder {
 
     }
 
+    /**
+     * @since 4.4.7
+     */
+    @Override
+    public String toString() {
+        return "[provider=" + provider + ", protocol=" + protocol + ", keymanagers=" + keyManagers
+                + ", trustmanagers=" + trustManagers + ", secureRandom=" + secureRandom + "]";
+    }
+
 }


[14/19] httpcomponents-core git commit: Update tests from Mockito 1.8.5 to 1.10.19. Tests pass on Oracle Java 1.6.0_45 and Maven 3.0.5.

Posted by ol...@apache.org.
Update tests from Mockito 1.8.5 to 1.10.19. Tests pass on Oracle Java 1.6.0_45 and Maven 3.0.5.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794462 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/a3c2fbd4
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/a3c2fbd4
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/a3c2fbd4

Branch: refs/heads/4.4.x
Commit: a3c2fbd4981443ee27885e18aaf2103aab6d57e6
Parents: 36cc72f
Author: Gary D. Gregory <gg...@apache.org>
Authored: Mon May 8 20:59:01 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:51:07 2017 +0200

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a3c2fbd4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 45103bc..9e4196d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
     <maven.compiler.target>1.6</maven.compiler.target>
     <maven.compiler.showDeprecation>false</maven.compiler.showDeprecation>
     <junit.version>4.11</junit.version>
-    <mockito.version>1.8.5</mockito.version>
+    <mockito.version>1.10.19</mockito.version>
     <commons-logging.version>1.2</commons-logging.version>
     <api.comparison.version>4.4</api.comparison.version>
     <hc.stylecheck.version>1</hc.stylecheck.version>


[10/19] httpcomponents-core git commit: HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String). Local build OK.

Posted by ol...@apache.org.
HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String). Local build OK.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794107 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/cbc80fc9
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/cbc80fc9
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/cbc80fc9

Branch: refs/heads/4.4.x
Commit: cbc80fc97ec874a1a09f3d9f91b7a4dd09d49899
Parents: d71bbb2
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 5 21:17:59 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:49:28 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 +++
 .../apache/http/benchmark/HttpBenchmark.java    |  2 +-
 .../org/apache/http/ssl/SSLContextBuilder.java  | 22 ++++++++++++++++++++
 .../apache/http/ssl/TestSSLContextBuilder.java  | 12 +++++++++++
 4 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index a3c75af..b29e546 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -15,6 +15,9 @@ Changelog
 * HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
----------------------------------------------------------------------
diff --git a/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java b/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
index a902819..3e15636 100644
--- a/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
+++ b/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
@@ -184,7 +184,7 @@ public class HttpBenchmark {
         SocketFactory socketFactory = null;
         if ("https".equals(host.getSchemeName())) {
             final SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
-            sslContextBuilder.useProtocol("SSL");
+            sslContextBuilder.setProtocol("SSL");
             if (config.isDisableSSLVerification()) {
                 sslContextBuilder.loadTrustMaterial(null, new TrustStrategy() {
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 70ed1f4..20d9eee 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -107,12 +107,34 @@ public class SSLContextBuilder {
      * @see <a href=
      *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @deprecated Use {@link #setProtocol(String)}.
      */
+    @Deprecated
     public SSLContextBuilder useProtocol(final String protocol) {
         this.protocol = protocol;
         return this;
     }
 
+    /**
+     * Sets the SSLContext algorithm name.
+     *
+     * @param protocol
+     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext section in the <a href=
+     *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *            Cryptography Architecture Standard Algorithm Name
+     *            Documentation</a> for more information.
+     * @return this builder
+     * @see <a href=
+     *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @since 4.4.7
+     */
+    public SSLContextBuilder setProtocol(final String protocol) {
+        this.protocol = protocol;
+        return this;
+    }
+
     public SSLContextBuilder setSecureRandom(final SecureRandom secureRandom) {
         this.secureRandom = secureRandom;
         return this;

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index b789fcf..c33ee11 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -90,6 +90,18 @@ public class TestSSLContextBuilder {
     @Test
     public void testBuildAllNull() throws Exception {
         final SSLContext sslContext = SSLContextBuilder.create()
+                .setProtocol(null)
+                .setSecureRandom(null)
+                .loadTrustMaterial((KeyStore) null, null)
+                .loadKeyMaterial((KeyStore) null, null, null)
+                .build();
+        Assert.assertNotNull(sslContext);
+        Assert.assertEquals("TLS", sslContext.getProtocol());
+    }
+
+    @Test
+    public void testBuildAllNull_deprecated() throws Exception {
+        final SSLContext sslContext = SSLContextBuilder.create()
                 .useProtocol(null)
                 .setSecureRandom(null)
                 .loadTrustMaterial((KeyStore) null, null)


[12/19] httpcomponents-core git commit: Add toString() method.

Posted by ol...@apache.org.
Add toString() method.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/1d9dff91
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/1d9dff91
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/1d9dff91

Branch: refs/heads/4.4.x
Commit: 1d9dff9118fcaaf686d7de0d75655a5b9b90b979
Parents: 0cc398f
Author: Gary D. Gregory <gg...@apache.org>
Authored: Sat May 6 19:18:09 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:50:40 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/impl/nio/SessionHttpContext.java    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/1d9dff91/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
index d597338..21b6ed6 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/SessionHttpContext.java
@@ -54,4 +54,16 @@ class SessionHttpContext implements HttpContext {
         this.iosession.setAttribute(id, obj);
     }
 
+    /**
+     * @since 4.4.7
+     */
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("[iosession=");
+        sb.append(iosession);
+        sb.append("]");
+        return sb.toString();
+    }
+
 }


[06/19] httpcomponents-core git commit: HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.

Posted by ol...@apache.org.
HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1793919 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d71bbb27
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d71bbb27
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d71bbb27

Branch: refs/heads/4.4.x
Commit: d71bbb27955d030db8a702caf33bf3373ed05aa7
Parents: 31edd6e
Author: Gary D. Gregory <gg...@apache.org>
Authored: Thu May 4 22:42:10 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:48:14 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 ++
 .../impl/nio/DefaultHttpServerIODispatch.java   | 38 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d71bbb27/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 4a3ea93..a3c75af 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -12,6 +12,9 @@ Changelog
 * HTTPCORE-460: Add factory methods to DefaultHttpClientIODispatch to handle a null SSLContext.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d71bbb27/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
index a49b1b3..3a1621b 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultHttpServerIODispatch.java
@@ -31,8 +31,8 @@ import java.io.IOException;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.reactor.AbstractIODispatch;
 import org.apache.http.nio.NHttpConnectionFactory;
@@ -54,6 +54,42 @@ import org.apache.http.util.Args;
 public class DefaultHttpServerIODispatch
                     extends AbstractIODispatch<DefaultNHttpServerConnection> {
 
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpServerIODispatch create(final NHttpServerEventHandler handler,
+            final SSLContext sslContext,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpServerIODispatch(handler, config)
+                : new DefaultHttpServerIODispatch(handler, sslContext, config);
+    }
+
+    /**
+     * Creates a new instance of this class to be used for dispatching I/O event
+     * notifications to the given protocol handler.
+     *
+     * @param handler the client protocol handler.
+     * @param sslContext an SSLContext or null (for a plain text connection.)
+     * @param sslHandler customizes various aspects of the TLS/SSL protocol.
+     * @param config a connection configuration
+     * @return a new instance
+     * @since 4.4.7
+     */
+    public static DefaultHttpServerIODispatch create(final NHttpServerEventHandler handler,
+            final SSLContext sslContext,
+            final SSLSetupHandler sslHandler,
+            final ConnectionConfig config) {
+        return sslContext == null ? new DefaultHttpServerIODispatch(handler, config)
+                : new DefaultHttpServerIODispatch(handler, sslContext, sslHandler, config);
+    }
+
     private final NHttpServerEventHandler handler;
     private final NHttpConnectionFactory<? extends DefaultNHttpServerConnection> connFactory;
 


[09/19] httpcomponents-core git commit: Format tweak.

Posted by ol...@apache.org.
Format tweak.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794116 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/51128f64
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/51128f64
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/51128f64

Branch: refs/heads/4.4.x
Commit: 51128f64aa5c2a119f2ed491c95dcec1c5f674a7
Parents: cbc80fc
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri May 5 23:35:18 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:49:28 2017 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/51128f64/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
index 6ce8653..fd75694 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLBuffer.java
@@ -32,6 +32,7 @@ import java.nio.ByteBuffer;
  * Managed internal SSL buffer.
  */
 public interface SSLBuffer {
+
     /**
      * Allocates the resources required for this buffer, or returns the resources already allocated for this buffer.
      * Unless {@link #release() } is called, multiple invokations to this method must return the same
@@ -39,15 +40,18 @@ public interface SSLBuffer {
      * @return buffer
      */
     ByteBuffer acquire();
+
     /**
      * Releases the resources for this buffer. If the buffer has already been released, this method does nothing.
      */
     void release();
+
     /**
      * Tests to see if this buffer has been acquired.
      * @return {@code true} if the buffer is acquired, otherwise {@code false}
      */
     boolean isAcquired();
+
     /**
      * Tests to make sure that the buffer has been acquired and the underlying buffer has a position larger than
      * {@code 0}. Essentially the same as {@code isAquired() && acquire().position > 0}.


[16/19] httpcomponents-core git commit: Change the example's hard-coded strings so that you can actually run it with SSL out of the box.

Posted by ol...@apache.org.
Change the example's hard-coded strings so that you can actually run it with SSL out of the box.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794638 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/291d6e36
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/291d6e36
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/291d6e36

Branch: refs/heads/4.4.x
Commit: 291d6e36f072bf97cda26851879d68d2c04ec22d
Parents: 05bd4af
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue May 9 21:37:46 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri May 12 09:54:36 2017 +0200

----------------------------------------------------------------------
 .../examples/org/apache/http/examples/nio/NHttpFileServer.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/291d6e36/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
index 612c02e..56dba42 100644
--- a/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
+++ b/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
@@ -78,13 +78,13 @@ public class NHttpFileServer {
         SSLContext sslContext = null;
         if (port == 8443) {
             // Initialize SSL context
-            URL url = NHttpFileServer.class.getResource("/my.keystore");
+            URL url = NHttpFileServer.class.getResource("/test.keystore");
             if (url == null) {
                 System.out.println("Keystore not found");
                 System.exit(1);
             }
             sslContext = SSLContexts.custom()
-                    .loadKeyMaterial(url, "secret".toCharArray(), "secret".toCharArray())
+                    .loadKeyMaterial(url, "nopassword".toCharArray(), "nopassword".toCharArray())
                     .build();
         }