use of javax.net.ssl.SSLServerSocket in project Payara by payara.
the class JSSESocketFactory method initServerSocket.
/**
* Configures the given SSL server socket with the requested cipher suites, protocol versions, and need for client
* authentication
*/
protected void initServerSocket(ServerSocket ssocket) {
if (!(ssocket instanceof SSLServerSocket)) {
throw new IllegalArgumentException("The ServerSocket has to be SSLServerSocket");
}
SSLServerSocket socket = (SSLServerSocket) ssocket;
if (attributes.get("ciphers") != null) {
socket.setEnabledCipherSuites(enabledCiphers);
}
String requestedProtocols = (String) attributes.get("protocols");
setEnabledProtocols(socket, getEnabledProtocols(socket, requestedProtocols));
// after parsing the request we may re-handshake
if (clientAuthNeed) {
socket.setNeedClientAuth(clientAuthNeed);
} else {
socket.setWantClientAuth(clientAuthWant);
}
}
use of javax.net.ssl.SSLServerSocket in project Payara by payara.
the class SecureRMIServerSocketFactory method createServerSocket.
@Override
public ServerSocket createServerSocket(int port) throws IOException {
// debug( "MyRMIServerSocketFactory.createServerSocket(): " + mAddress + " : " + port );
if (socketMap.containsKey(port)) {
return (ServerSocket) socketMap.get(port);
}
// plenty
final int backlog = 5;
// we use a custom class here. The reason is mentioned in the class.
final JMXSslConfigHolder sslConfigHolder;
try {
sslConfigHolder = new JMXSslConfigHolder(habitat, ssl);
} catch (SSLException ssle) {
throw new IllegalStateException(ssle);
}
final SSLContext context = sslConfigHolder.getSslContext();
ServerSocket sslSocket = context.getServerSocketFactory().createServerSocket(port, backlog, mAddress);
if (!(sslSocket instanceof SSLServerSocket)) {
throw new IllegalStateException("ServerSocketFactory returned non-secure server socket.");
}
configureSSLSocket((SSLServerSocket) sslSocket, sslConfigHolder);
Util.getLogger().log(Level.INFO, createdServerSocket, new Object[] { sslSocket.getLocalSocketAddress(), sslSocket.toString() });
// sslSocket.startHandshake();
// debug( "MyRMIServerSocketFactory.createServerSocket(): " + mAddress + " : " + port );
socketMap.put(port, sslSocket);
return sslSocket;
}
Aggregations