You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2011/07/14 12:34:44 UTC

svn commit: r1146636 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/nio/ test/java/org/apache/activemq/transport/nio/

Author: dejanb
Date: Thu Jul 14 10:34:43 2011
New Revision: 1146636

URL: http://svn.apache.org/viewvc?rev=1146636&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-2583 - nio+ssl enable setting ssl engine properties like enabledCipherSuites

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLLoadTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLTransportBrokerTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java?rev=1146636&r1=1146635&r2=1146636&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java Thu Jul 14 10:34:43 2011
@@ -36,6 +36,10 @@ import java.nio.ByteBuffer;
 
 public class NIOSSLTransport extends NIOTransport  {
 
+    private boolean needClientAuth;
+    private boolean wantClientAuth;
+    private String[] enabledCipherSuites;
+
     protected SSLContext sslContext;
     protected SSLEngine sslEngine;
     protected SSLSession sslSession;
@@ -59,7 +63,6 @@ public class NIOSSLTransport extends NIO
 
     @Override
     protected void initializeStreams() throws IOException {
-
         try {
             channel = socket.getChannel();
             channel.configureBlocking(false);
@@ -68,8 +71,13 @@ public class NIOSSLTransport extends NIO
                 sslContext = SSLContext.getDefault();
             }
 
+            // initialize engine
             sslEngine = sslContext.createSSLEngine();
             sslEngine.setUseClientMode(false);
+            sslEngine.setEnabledCipherSuites(enabledCipherSuites);
+            sslEngine.setNeedClientAuth(needClientAuth);
+            sslEngine.setWantClientAuth(wantClientAuth);
+
             sslSession = sslEngine.getSession();
 
             inputBuffer = ByteBuffer.allocate(sslSession.getPacketBufferSize());
@@ -246,4 +254,28 @@ public class NIOSSLTransport extends NIO
         }
         super.doStop(stopper);
     }
+
+    public boolean isNeedClientAuth() {
+        return needClientAuth;
+    }
+
+    public void setNeedClientAuth(boolean needClientAuth) {
+        this.needClientAuth = needClientAuth;
+    }
+
+    public boolean isWantClientAuth() {
+        return wantClientAuth;
+    }
+
+    public void setWantClientAuth(boolean wantClientAuth) {
+        this.wantClientAuth = wantClientAuth;
+    }
+
+    public String[] getEnabledCipherSuites() {
+        return enabledCipherSuites;
+    }
+
+    public void setEnabledCipherSuites(String[] enabledCipherSuites) {
+        this.enabledCipherSuites = enabledCipherSuites;
+    }
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLLoadTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLLoadTest.java?rev=1146636&r1=1146635&r2=1146636&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLLoadTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLLoadTest.java Thu Jul 14 10:34:43 2011
@@ -59,11 +59,11 @@ public class NIOSSLLoadTest extends Test
         broker = new BrokerService();
         broker.setPersistent(false);
         broker.setUseJmx(false);
-        TransportConnector connector = broker.addConnector("nio+ssl://localhost:0");
+        TransportConnector connector = broker.addConnector("nio+ssl://localhost:0?transport.needClientAuth=true&transport.enabledCipherSuites=SSL_RSA_WITH_RC4_128_SHA,SSL_DH_anon_WITH_3DES_EDE_CBC_SHA");
         broker.start();
         broker.waitUntilStarted();
 
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connector.getConnectUri());
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("nio+ssl://localhost:" + connector.getConnectUri().getPort());
         connection = factory.createConnection();
         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         connection.start();

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLTransportBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLTransportBrokerTest.java?rev=1146636&r1=1146635&r2=1146636&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLTransportBrokerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/nio/NIOSSLTransportBrokerTest.java Thu Jul 14 10:34:43 2011
@@ -30,12 +30,12 @@ public class NIOSSLTransportBrokerTest e
     public static final String TRUST_KEYSTORE = "src/test/resources/client.keystore";
 
     protected String getBindLocation() {
-        return "nio+ssl://localhost:0";
+        return "nio+ssl://localhost:0?transport.soWriteTimeout=20000";
     }
 
     @Override
     protected URI getBindURI() throws URISyntaxException {
-        return new URI("nio+ssl://localhost:0");
+        return new URI("nio+ssl://localhost:0?soWriteTimeout=20000");
     }
 
     protected void setUp() throws Exception {