Avoid binding JMX rmiRegistryHost to 0.0.0.0 when using 127.0.0.1
@@ -568,7 +568,7 @@ public class ConnectorServerFactory {
public ServerSocket createServerSocket(int port) throws IOException {
InetAddress host = InetAddress.getByName(rmiServerHost);
if (host.isLoopbackAddress()) {
- final SSLServerSocket ss = (SSLServerSocket) sssf.createServerSocket(port, 50);
+ final SSLServerSocket ss = (SSLServerSocket) sssf.createServerSocket(port, 50, host);
ss.setNeedClientAuth(clientAuth);
if (this.enabledProtocols != null && this.enabledProtocols.length > 0) {
ss.setEnabledProtocols(this.enabledProtocols);
@@ -601,7 +601,7 @@ public class ConnectorServerFactory {
public ServerSocket createServerSocket(int port) throws IOException {
InetAddress host = InetAddress.getByName(rmiServerHost);
if (host.isLoopbackAddress()) {
- final ServerSocket ss = ServerSocketFactory.getDefault().createServerSocket(port, 50);
+ final ServerSocket ss = ServerSocketFactory.getDefault().createServerSocket(port, 50, host);
return new LocalOnlyServerSocket(ss);
} else {
final ServerSocket ss = ServerSocketFactory.getDefault().createServerSocket(port, 50, InetAddress.getByName(rmiServerHost));
@@ -926,7 +926,7 @@ public class ConnectorServerFactory {
private final String lookupName;
JmxRegistry(final int port, final String lookupName) throws RemoteException {
- super(port);
+ super(port, null, new KarafRMIServerSocketFactory(getHost()));
this.lookupName = lookupName;
}
