public ServerSocket createServerSocket(int port) throws IOException {
ServerSocket serversocket = null;
if (useSSL) {
SSLServerSocketFactory ssf =
(SSLServerSocketFactory)getSSLServerSocketFactory();
if (jmxHostname != null && !jmxHostname.equals(Globals.HOSTNAME_ALL)) {
/*
* Scenario: SSL + multihome
*/
InetAddress bindAddr = Globals.getJMXInetAddress();
InetSocketAddress endpoint = new InetSocketAddress(bindAddr, port);
serversocket = (SSLServerSocket)ssf.createServerSocket();
serversocket.setReuseAddress(true);
serversocket.bind(endpoint, backlog);
} else {
/*
* Scenario: SSL
*/
InetSocketAddress endpoint = new InetSocketAddress(port);
serversocket = (SSLServerSocket)ssf.createServerSocket();
serversocket.setReuseAddress(true);
serversocket.bind(endpoint, backlog);
}