You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/02/03 18:05:48 UTC

[2/3] qpid-jms git commit: Test that we add the verification alogorithm when verify host is enabled.

Test that we add the verification alogorithm when verify host is
enabled.

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/70b63d0b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/70b63d0b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/70b63d0b

Branch: refs/heads/master
Commit: 70b63d0ba29756ad2ee7d5b01904fcc361dabf13
Parents: 1ee2e5b
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Feb 3 10:59:46 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Feb 3 10:59:46 2015 -0500

----------------------------------------------------------------------
 .../jms/transports/TransportSupportTest.java    | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/70b63d0b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
index 4baff64..09314ba 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
@@ -19,6 +19,7 @@ package org.apache.qpid.jms.transports;
 import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
@@ -126,6 +127,44 @@ public class TransportSupportTest extends QpidJmsTestCase {
         assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
     }
 
+    @Test
+    public void testCreateSslEngineWithVerifyHost() throws Exception {
+        TransportSslOptions options = createJksSslOptions();
+        options.setVerifyHost(true);
+
+        SSLContext context = TransportSupport.createSslContext(options);
+        assertNotNull(context);
+
+        SSLEngine engine = TransportSupport.createSslEngine(context, options);
+        assertNotNull(engine);
+
+        assertEquals("HTTPS", engine.getSSLParameters().getEndpointIdentificationAlgorithm());
+
+        List<String> engineProtocols = Arrays.asList(engine.getEnabledProtocols());
+        List<String> defaultProtocols = Arrays.asList(TransportSslOptions.DEFAULT_ENABLED_PROTOCOLS);
+
+        assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
+    }
+
+    @Test
+    public void testCreateSslEngineWithoutVerifyHost() throws Exception {
+        TransportSslOptions options = createJksSslOptions();
+        options.setVerifyHost(false);
+
+        SSLContext context = TransportSupport.createSslContext(options);
+        assertNotNull(context);
+
+        SSLEngine engine = TransportSupport.createSslEngine(context, options);
+        assertNotNull(engine);
+
+        assertNull(engine.getSSLParameters().getEndpointIdentificationAlgorithm());
+
+        List<String> engineProtocols = Arrays.asList(engine.getEnabledProtocols());
+        List<String> defaultProtocols = Arrays.asList(TransportSslOptions.DEFAULT_ENABLED_PROTOCOLS);
+
+        assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
+    }
+
     private TransportSslOptions createJksSslOptions() {
         TransportSslOptions options = new TransportSslOptions();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org