Author: ron.sigal(a)jboss.com
Date: 2008-02-29 03:24:59 -0500 (Fri, 29 Feb 2008)
New Revision: 3542
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java
Log:
JBREM-703: Added configuration for remaining ssl socket parameters.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java 2008-02-29
08:24:27 UTC (rev 3541)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java 2008-02-29
08:24:59 UTC (rev 3542)
@@ -36,6 +36,7 @@
import java.io.IOException;
import java.net.Socket;
import java.net.InetSocketAddress;
+import java.net.SocketException;
import java.util.Map;
/**
@@ -45,6 +46,10 @@
{
private static final Logger log = Logger.getLogger(SSLSocketClientInvoker.class);
private static final boolean isTraceEnabled = log.isTraceEnabled();
+
+ protected String[] enabledCipherSuites;
+ protected String[] enabledProtocols;
+ protected boolean enableSessionCreation = true;
public SSLSocketClientInvoker(InvokerLocator locator) throws IOException
{
@@ -74,6 +79,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);
@@ -115,7 +168,7 @@
Socket s = sf.createSocket();
- s.setReuseAddress(getReuseAddress());
+ configureSocket(s);
InetSocketAddress inetAddr = new InetSocketAddress(address, port);
if (timeout < 0)
@@ -141,6 +194,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