Author: remy.maucherat(a)jboss.com
Date: 2008-06-04 20:47:39 -0400 (Wed, 04 Jun 2008)
New Revision: 658
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
trunk/java/org/jboss/web/cluster/JSSESocketFactory.java
Log:
- Use the socket factory.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-06-04 19:57:54 UTC (rev
657)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-06-05 00:47:39 UTC (rev
658)
@@ -114,9 +114,9 @@
/**
* Socket factory.
*/
+ protected JSSESocketFactory sslSocketFactory = null;
-
// ------------------------------------------------------------- Properties
@@ -1217,6 +1217,9 @@
* SSL init.
*/
protected void sslInit() {
+ if (ssl) {
+ sslSocketFactory = new JSSESocketFactory(this);
+ }
}
@@ -1225,25 +1228,22 @@
*/
protected Socket getConnection(int i)
throws IOException {
- // FIXME: Add SSL (using a client cert)
- if (!ssl) {
- if (proxies[i].address == null) {
- return new Socket(InetAddress.getLocalHost(), proxies[i].port);
- } else {
- return new Socket(proxies[i].address, proxies[i].port);
- }
+ InetAddress address =
+ (proxies[i].address == null) ? InetAddress.getLocalHost() :
proxies[i].address;
+ if (ssl) {
+ return sslSocketFactory.createSocket(address, proxies[i].port);
} else {
- if (proxies[i].address == null) {
- return SSLSocketFactory.getDefault()
- .createSocket(InetAddress.getLocalHost(), proxies[i].port);
- } else {
- return SSLSocketFactory.getDefault()
- .createSocket(proxies[i].address, proxies[i].port);
- }
+ return new Socket(address, proxies[i].port);
}
}
+ // ------------------------------------------------------ Proxy Inner Class
+
+
+ /**
+ * This class represents a front-end httpd server.
+ */
protected static class Proxy {
public InetAddress address = null;
public int port = 8000;
Modified: trunk/java/org/jboss/web/cluster/JSSESocketFactory.java
===================================================================
--- trunk/java/org/jboss/web/cluster/JSSESocketFactory.java 2008-06-04 19:57:54 UTC (rev
657)
+++ trunk/java/org/jboss/web/cluster/JSSESocketFactory.java 2008-06-05 00:47:39 UTC (rev
658)
@@ -23,9 +23,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
-import java.net.ServerSocket;
import java.net.Socket;
-import java.net.SocketException;
import java.security.KeyStore;
import java.security.SecureRandom;
import java.security.cert.CRL;
@@ -39,7 +37,6 @@
import java.security.cert.PKIXBuilderParameters;
import java.security.cert.X509CertSelector;
import java.util.Collection;
-import java.util.HashMap;
import java.util.Vector;
import javax.net.ssl.CertPathTrustManagerParameters;
@@ -47,7 +44,6 @@
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.ManagerFactoryParameters;
import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
Show replies by date