Implementation of the only method in {@link RMIServerSocketFactory}. This
method is called for creating the server socket.
try {
/* My belief is that one of the bootstrap classes for
* initializing the SSL Context and the proper (pluggable)
* Key and Trust Managers are in place. We just need to leverage that.
*/
// first get the SSLContext - returned as a new one - http://java.sun.com/j2se/1.4.2/docs/guide/security/jsse/JSSERefGuide.html#AppA
final SSLContext ctx = SSLContext.getInstance("TLSv1");
// get the key and trust managers
final KeyManager[] kms = SSLUtils.getKeyManagers();
J2EEKeyManager[] jkms = new J2EEKeyManager[kms.length];
for (int i = 0; i < kms.length; i++) {
jkms[i] = new J2EEKeyManager((X509KeyManager)kms[i], sslc.getCertNickname());
}
final TrustManager[] tms = null; //not needed really untill we support client auth
final SecureRandom sr = null; // need to handle better?
// now initialize the SSLContext gotten above and return
ctx.init(jkms, tms, sr);
final SSLServerSocketFactory sf = ctx.getServerSocketFactory();
InetAddress bindAddress = null;
ServerSocket sss = null;
if (address.equals(DEFAULT_ADDRESS))
sss = sf.createServerSocket(port);
else {
bindAddress = InetAddress.getByName(address);
sss = sf.createServerSocket(port, 0, bindAddress);
}
debug(sss);
return ( sss );
}
catch (final Exception e) {
throw new IOException(e.getMessage());
}