cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/6] cxf git commit: Adding some TLSv1.1 and TLSv1.0 client tests
Date Tue, 12 May 2015 15:40:13 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 6e4f66e2c -> cadb4e5a1


Adding some TLSv1.1 and TLSv1.0 client tests


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/27596ba4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/27596ba4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/27596ba4

Branch: refs/heads/3.0.x-fixes
Commit: 27596ba465ee4438a4d60836c6fe6e5af05cca30
Parents: 6e4f66e
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon May 11 16:19:16 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue May 12 16:32:04 2015 +0100

----------------------------------------------------------------------
 .../https/ciphersuites/CipherSuitesTest.java    | 76 ++++++++++++++++++++
 1 file changed, 76 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/27596ba4/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
index c363cc7..e66504a 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
@@ -527,6 +527,82 @@ public class CipherSuitesTest extends AbstractBusClientServerTestBase
{
         bus.shutdown(true);
     }
     
+    // Both client + server include AES, client is TLSv1.1
+    @org.junit.Test
+    public void testAESIncludedTLSv11() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client-noconfig.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL url = SOAPService.WSDL_LOCATION;
+        SOAPService service = new SOAPService(url, SOAPService.SERVICE);
+        assertNotNull("Service is null", service);   
+        final Greeter port = service.getHttpsPort();
+        assertNotNull("Port is null", port);
+        
+        updateAddressPort(port, PORT);
+        
+        Client client = ClientProxy.getClient(port);
+        HTTPConduit conduit = (HTTPConduit) client.getConduit();
+
+        TLSClientParameters tlsParams = new TLSClientParameters();
+        X509TrustManager trustManager = new NoOpX509TrustManager();
+        TrustManager[] trustManagers = new TrustManager[1];
+        trustManagers[0] = trustManager;
+        tlsParams.setTrustManagers(trustManagers);
+        tlsParams.setDisableCNCheck(true);
+        
+        tlsParams.setSecureSocketProtocol("TLSv1.1");
+
+        conduit.setTlsClientParameters(tlsParams);
+        
+        assertEquals(port.greetMe("Kitty"), "Hello Kitty");
+        
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
+    
+    // Both client + server include AES, client is TLSv1.0
+    @org.junit.Test
+    public void testAESIncludedTLSv10() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client-noconfig.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL url = SOAPService.WSDL_LOCATION;
+        SOAPService service = new SOAPService(url, SOAPService.SERVICE);
+        assertNotNull("Service is null", service);   
+        final Greeter port = service.getHttpsPort();
+        assertNotNull("Port is null", port);
+        
+        updateAddressPort(port, PORT);
+        
+        Client client = ClientProxy.getClient(port);
+        HTTPConduit conduit = (HTTPConduit) client.getConduit();
+
+        TLSClientParameters tlsParams = new TLSClientParameters();
+        X509TrustManager trustManager = new NoOpX509TrustManager();
+        TrustManager[] trustManagers = new TrustManager[1];
+        trustManagers[0] = trustManager;
+        tlsParams.setTrustManagers(trustManagers);
+        tlsParams.setDisableCNCheck(true);
+        
+        tlsParams.setSecureSocketProtocol("TLSv1");
+
+        conduit.setTlsClientParameters(tlsParams);
+        
+        assertEquals(port.greetMe("Kitty"), "Hello Kitty");
+        
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
+    
     private static class NoOpX509TrustManager implements X509TrustManager {
 
         public NoOpX509TrustManager() {


Mime
View raw message