hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1783962 - /httpcomponents/httpclient/branches/4.5.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
Date Wed, 22 Feb 2017 01:27:50 GMT
Author: ggregory
Date: Wed Feb 22 01:27:50 2017
New Revision: 1783962

URL: http://svn.apache.org/viewvc?rev=1783962&view=rev
Log:
Tab police and use // @formatter:[off|on]

Modified:
    httpcomponents/httpclient/branches/4.5.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java?rev=1783962&r1=1783961&r2=1783962&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
Wed Feb 22 01:27:50 2017
@@ -89,10 +89,12 @@ public class TestSSLSocketFactory {
 
     @Test
     public void testBasicSSL() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
@@ -102,7 +104,8 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         try {
             final SSLSession sslsession = sslSocket.getSession();
 
@@ -115,10 +118,12 @@ public class TestSSLSocketFactory {
 
     @Test
     public void testBasicDefaultHostnameVerifier() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
@@ -127,7 +132,8 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         try {
             final SSLSession sslsession = sslSocket.getSession();
 
@@ -139,10 +145,12 @@ public class TestSSLSocketFactory {
 
     @Test
     public void testClientAuthSSL() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
@@ -152,7 +160,8 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         try {
             final SSLSession sslsession = sslSocket.getSession();
 
@@ -163,8 +172,9 @@ public class TestSSLSocketFactory {
         }
     }
 
-    @Test(expected=IOException.class)
+    @Test(expected = IOException.class)
     public void testClientAuthSSLFailure() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
@@ -177,6 +187,7 @@ public class TestSSLSocketFactory {
 
                 })
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
@@ -186,7 +197,8 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         try {
             final SSLSession sslsession = sslSocket.getSession();
 
@@ -197,12 +209,14 @@ public class TestSSLSocketFactory {
         }
     }
 
-    @Test(expected=SSLException.class)
+    @Test(expected = SSLException.class)
     public void testSSLTrustVerification() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
@@ -215,7 +229,8 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         sslSocket.close();
     }
 
@@ -224,8 +239,7 @@ public class TestSSLSocketFactory {
         final TrustStrategy trustStrategy = new TrustStrategy() {
 
             @Override
-            public boolean isTrusted(
-                    final X509Certificate[] chain, final String authType) throws CertificateException
{
+            public boolean isTrusted(final X509Certificate[] chain, final String authType)
throws CertificateException {
                 return chain.length == 1;
             }
 
@@ -243,32 +257,37 @@ public class TestSSLSocketFactory {
         testSSLTrustVerificationOverride(TrustAllStrategy.INSTANCE);
     }
 
-	private void testSSLTrustVerificationOverride(final TrustStrategy trustStrategy)
-			throws Exception, IOException, NoSuchAlgorithmException, KeyManagementException, KeyStoreException
{
+    private void testSSLTrustVerificationOverride(final TrustStrategy trustStrategy)
+            throws Exception, IOException, NoSuchAlgorithmException, KeyManagementException,
KeyStoreException {
+        // @formatter:off
 		this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
 
+        // @formatter:off
         final SSLContext sslcontext = SSLContexts.custom()
             .loadTrustMaterial(null, trustStrategy)
             .build();
-        final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
-                sslcontext,
+        // @formatter:on
+        final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslcontext,
                 NoopHostnameVerifier.INSTANCE);
 
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         sslSocket.close();
-	}
+    }
 
     @Test
     public void testTLSOnly() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
@@ -281,6 +300,7 @@ public class TestSSLSocketFactory {
 
                 })
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();
@@ -289,13 +309,15 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null, context);
+        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target,
remoteAddress, null,
+                context);
         final SSLSession sslsession = sslSocket.getSession();
         Assert.assertNotNull(sslsession);
     }
 
-    @Test(expected=IOException.class)
+    @Test(expected = IOException.class)
     public void testSSLDisabledByDefault() throws Exception {
+        // @formatter:off
         this.server = ServerBootstrap.bootstrap()
                 .setServerInfo(LocalServerTestBase.ORIGIN)
                 .setSslContext(SSLTestContexts.createServerSSLContext())
@@ -308,6 +330,7 @@ public class TestSSLSocketFactory {
 
                 })
                 .create();
+        // @formatter:on
         this.server.start();
 
         final HttpContext context = new BasicHttpContext();



Mime
View raw message