[jboss-remoting-commits] JBoss Remoting SVN: r3540 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Feb 29 03:23:54 EST 2008


Author: ron.sigal at jboss.com
Date: 2008-02-29 03:23:54 -0500 (Fri, 29 Feb 2008)
New Revision: 3540

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java
Log:
JBREM-703: Added configuration for remaining ssl socket parameters.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java	2008-02-29 08:23:09 UTC (rev 3539)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java	2008-02-29 08:23:54 UTC (rev 3540)
@@ -25,6 +25,7 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.Socket;
+import java.net.SocketException;
 import java.util.Map;
 
 import javax.net.SocketFactory;
@@ -47,6 +48,10 @@
 {
    private static final Logger log = Logger.getLogger(SSLBisocketClientInvoker.class);
 
+   protected String[] enabledCipherSuites;
+   protected String[] enabledProtocols;
+   protected boolean enableSessionCreation = true;
+   
    public SSLBisocketClientInvoker(InvokerLocator locator) throws IOException
    {
       super(locator);
@@ -75,6 +80,54 @@
       }
    }
 
+   public void setOOBInline(boolean inline)
+   {
+      log.warn("Ignored: sending urgent data is not supported by SSLSockets");
+   }
+   
+   public String[] getEnabledCipherSuites()
+   {
+      return enabledCipherSuites;
+   }
+
+   public void setEnabledCipherSuites(String[] enabledCipherSuites)
+   {
+      this.enabledCipherSuites = enabledCipherSuites;
+   }
+
+   public String[] getEnabledProtocols()
+   {
+      return enabledProtocols;
+   }
+
+   public void setEnabledProtocols(String[] enabledProtocols)
+   {
+      this.enabledProtocols = enabledProtocols;
+   }
+
+   public boolean isEnableSessionCreation()
+   {
+      return enableSessionCreation;
+   }
+
+   public void setEnableSessionCreation(boolean enableSessionCreation)
+   {
+      this.enableSessionCreation = enableSessionCreation;
+   }
+   
+   protected void setup() throws Exception
+   {
+      super.setup();
+      
+      Object o = configuration.get("enabledCipherSuites");
+      if (o instanceof String[])
+         setEnabledCipherSuites((String[]) o);
+      
+      o = configuration.get("enabledProtocols");
+      if (o instanceof String[])
+         setEnabledProtocols((String[]) o);
+   }
+   
    protected SocketFactory createSocketFactory(Map configuration)
    {
       SocketFactory sf = super.createSocketFactory(configuration);
@@ -117,7 +170,7 @@
 
       Socket s = sf.createSocket();
 
-      s.setReuseAddress(getReuseAddress());
+      configureSocket(s);
       InetSocketAddress inetAddr = new InetSocketAddress(address, port);
       
       if (timeout < 0)
@@ -144,6 +197,32 @@
       return s;
    }
 
+   protected void configureSocket(Socket s) throws SocketException
+   {
+      s.setReuseAddress(getReuseAddress());
+      
+      if (keepAliveSet)           s.setKeepAlive(keepAlive);
+      if (receiveBufferSize > -1) s.setReceiveBufferSize(receiveBufferSize);
+      if (sendBufferSize > -1)    s.setSendBufferSize(sendBufferSize);
+      if (soLingerSet && 
+            soLingerDuration > 0) s.setSoLinger(soLinger, soLingerDuration);
+      if (trafficClass > -1)      s.setTrafficClass(trafficClass);
+      
+      if (s instanceof SSLSocket)
+      {
+         SSLSocket ss = (SSLSocket) s;
+         if (enabledCipherSuites != null)
+         {
+            ss.setEnabledCipherSuites(enabledCipherSuites);
+         }
+         if (enabledProtocols != null)
+         {
+            ss.setEnabledProtocols(enabledProtocols);
+         }
+         ss.setEnableSessionCreation(enableSessionCreation);
+      }
+   }
+   
    private void establishHandshake(SSLSocket sslSocket, HandshakeCompletedListener listener)
          throws IOException
    {




More information about the jboss-remoting-commits mailing list