geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [geode] branch develop updated: GEODE-7541: move SocketCreator localhost lookup to geode-common (#4527)
Date Thu, 26 Dec 2019 21:11:18 GMT
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new ceea971  GEODE-7541: move SocketCreator localhost lookup to geode-common (#4527)
ceea971 is described below

commit ceea971a808aa3e88be4e9034018d10108e5ea14
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
AuthorDate: Thu Dec 26 13:10:48 2019 -0800

    GEODE-7541: move SocketCreator localhost lookup to geode-common (#4527)
    
    * GEODE-7541: move SocketCreator localhost lookup to geode-common
    
    General host address lookup remains in SocketCreator while localhost-
    related functionality has moved to LocalHostUtil.
    
    * added deprecated SocketCreator.getLocalHost() for use in upgrade tests
    
    * hardening tests for stressTest environment
    
    * merging with develop
    
    * remove use of system properties.  ensure old locator directories are cleaned up
---
 .../apache/geode/metrics/CacheCommonTagsTest.java  |   3 +-
 .../apache/geode/internal/inet/LocalHostUtil.java  | 286 +++++++++++++++++++++
 .../distributed/DistributedSystemDUnitTest.java    |   2 +-
 .../geode/distributed/HostedLocatorsDUnitTest.java |  88 ++++---
 .../LocatorLauncherLocalIntegrationTest.java       |   2 +-
 .../LocatorLauncherRemoteIntegrationTest.java      |   2 +-
 .../ServerLauncherLocalIntegrationTest.java        |   2 +-
 .../ServerLauncherRemoteIntegrationTest.java       |   2 +-
 .../internal/membership/MembershipJUnitTest.java   |   8 +-
 .../gms/MemberIdentifierFactoryImplTest.java       |   6 +-
 .../locator/GMSLocatorRecoveryIntegrationTest.java |   4 +-
 .../internal/net/SSLSocketIntegrationTest.java     |  50 ++--
 .../GemFireStatSamplerIntegrationTest.java         |   2 +-
 .../SimpleStatSamplerIntegrationTest.java          |   3 +-
 ...ederatingManagerConcurrencyIntegrationTest.java |   2 +-
 .../apache/geode/admin/GemFireMemberStatus.java    |   4 +-
 .../internal/DistributedSystemHealthMonitor.java   |   4 +-
 .../admin/internal/ManagedEntityConfigImpl.java    |   3 +-
 .../java/org/apache/geode/distributed/Locator.java |   3 +-
 .../apache/geode/distributed/LocatorLauncher.java  |   5 +-
 .../apache/geode/distributed/ServerLauncher.java   |   6 +-
 .../internal/AbstractDistributionConfig.java       |  22 +-
 .../internal/ClusterDistributionManager.java       |   4 +-
 .../internal/DistributionConfigImpl.java           |   3 +-
 .../distributed/internal/InternalLocator.java      |   6 +-
 .../internal/LonerDistributionManager.java         |   3 +-
 .../geode/distributed/internal/ServerLocation.java |   4 +-
 .../geode/distributed/internal/ServerLocator.java  |   6 +-
 .../geode/distributed/internal/StartupMessage.java |   4 +-
 .../distributed/internal/direct/DirectChannel.java |   4 +-
 .../membership/InternalDistributedMember.java      |   7 +-
 .../adapter/TcpSocketCreatorAdapter.java           |   3 +-
 .../internal/membership/gms/GMSUtil.java           |   4 +-
 .../org/apache/geode/internal/AvailablePort.java   |   4 +-
 .../apache/geode/internal/VersionDescription.java  |   4 +-
 .../admin/remote/DistributionLocatorId.java        |   9 +-
 .../internal/admin/remote/FetchHostResponse.java   |   4 +-
 .../geode/internal/cache/GemFireCacheImpl.java     |   5 +-
 .../partitioned/PersistentBucketRecoverer.java     |   4 +-
 .../internal/cache/tier/sockets/AcceptorImpl.java  |   5 +-
 .../geode/internal/net/InetAddressUtils.java       |   5 +-
 .../apache/geode/internal/net/SocketCreator.java   | 253 +-----------------
 .../geode/internal/statistics/HostStatSampler.java |   3 +-
 .../internal/statistics/OsStatisticsProvider.java  |   4 +-
 .../internal/statistics/StatArchiveWriter.java     |   3 +-
 .../org/apache/geode/internal/tcp/TCPConduit.java  |   3 +-
 .../management/internal/JmxManagerAdvisee.java     |   4 +-
 .../geode/management/internal/ManagementAgent.java |   5 +-
 .../geode/management/internal/RestAgent.java       |   6 +-
 .../internal/beans/MemberMBeanBridge.java          |   4 +-
 .../geode/management/internal/util/HostUtils.java  |   4 +-
 .../internal/StartupMessageDataJUnitTest.java      |   6 +-
 .../MembershipDependenciesJUnitTest.java           |   6 +-
 .../membership/MembershipViewJUnitTest.java        |   6 +-
 .../auth/AbstractGMSAuthenticatorTestCase.java     |   4 +-
 .../PartitionedRegionLoadModelJUnitTest.java       |   4 +-
 .../cache/versions/RegionVersionVectorTest.java    |   4 +-
 .../apache/geode/internal/tcp/ConnectionTest.java  |   2 +-
 .../geode/memcached/GemFireMemcachedServer.java    |   5 +-
 .../org/apache/geode/redis/RedisDistDUnitTest.java |   6 +-
 .../org/apache/geode/redis/GeodeRedisServer.java   |   4 +-
 .../tcpserver/TcpServerGossipVersionDUnitTest.java |   4 +-
 .../CreateGatewayReceiverCommandDUnitTest.java     |   4 +-
 .../internal/cache/wan/GatewayReceiverImpl.java    |   4 +-
 .../cache/wan/GatewayReceiverImplTest.java         |   4 +-
 65 files changed, 502 insertions(+), 447 deletions(-)

diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/CacheCommonTagsTest.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/CacheCommonTagsTest.java
index 451b2da..1ca677c 100644
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/CacheCommonTagsTest.java
+++ b/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/CacheCommonTagsTest.java
@@ -29,6 +29,7 @@ import org.junit.Test;
 
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 
 public class CacheCommonTagsTest {
@@ -56,7 +57,7 @@ public class CacheCommonTagsTest {
 
       assertThat(meter.getId().getTags())
           .as("Tags for meter with name " + meterId.getName())
-          .contains(Tag.of("host", SocketCreator.getHostName(SocketCreator.getLocalHost())));
+          .contains(Tag.of("host", SocketCreator.getHostName(LocalHostUtil.getLocalHost())));
     }
   }
 
diff --git a/geode-common/src/main/java/org/apache/geode/internal/inet/LocalHostUtil.java b/geode-common/src/main/java/org/apache/geode/internal/inet/LocalHostUtil.java
new file mode 100644
index 0000000..f904c55
--- /dev/null
+++ b/geode-common/src/main/java/org/apache/geode/internal/inet/LocalHostUtil.java
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.inet;
+
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
+import org.apache.geode.annotations.internal.MakeNotStatic;
+
+/**
+ * LocalHostUtil provides lookup for the preferred local host InetAddress. It makes up
+ * for deficiencies in /etc/hosts configuration and tries to ensure that, if available,
+ * a non-loopback address is used.
+ */
+
+public class LocalHostUtil {
+  /**
+   * Optional system property to enable GemFire usage of link-local addresses
+   */
+  private static final String USE_LINK_LOCAL_ADDRESSES_PROPERTY =
+      "gemfire.net.useLinkLocalAddresses";
+
+  /**
+   * True if GemFire should use link-local addresses
+   */
+  private static final boolean useLinkLocalAddresses =
+      Boolean.getBoolean(USE_LINK_LOCAL_ADDRESSES_PROPERTY);
+
+  /**
+   * we cache localHost to avoid bug #40619, access-violation in native code
+   */
+  private static final InetAddress localHost;
+
+  /**
+   * all classes should use this variable to determine whether to use IPv4 or IPv6 addresses
+   */
+  @MakeNotStatic
+  private static boolean useIPv6Addresses = !Boolean.getBoolean("java.net.preferIPv4Stack")
+      && Boolean.getBoolean("java.net.preferIPv6Addresses");
+
+  static {
+    InetAddress inetAddress = null;
+    try {
+      inetAddress = InetAddress.getByAddress(InetAddress.getLocalHost().getAddress());
+      if (inetAddress.isLoopbackAddress()) {
+        InetAddress ipv4Fallback = null;
+        InetAddress ipv6Fallback = null;
+        // try to find a non-loopback address
+        Set<InetAddress> myInterfaces = getMyAddresses();
+        boolean preferIPv6 = useIPv6Addresses;
+        String lhName = null;
+        for (InetAddress addr : myInterfaces) {
+          if (addr.isLoopbackAddress() || addr.isAnyLocalAddress() || lhName != null) {
+            break;
+          }
+          boolean ipv6 = addr instanceof Inet6Address;
+          boolean ipv4 = addr instanceof Inet4Address;
+          if ((preferIPv6 && ipv6) || (!preferIPv6 && ipv4)) {
+            String addrName = reverseDNS(addr);
+            if (inetAddress.isLoopbackAddress()) {
+              inetAddress = addr;
+              lhName = addrName;
+            } else if (addrName != null) {
+              inetAddress = addr;
+              lhName = addrName;
+            }
+          } else {
+            if (preferIPv6 && ipv4 && ipv4Fallback == null) {
+              ipv4Fallback = addr;
+            } else if (!preferIPv6 && ipv6 && ipv6Fallback == null) {
+              ipv6Fallback = addr;
+            }
+          }
+        }
+        // vanilla Ubuntu installations will have a usable IPv6 address when
+        // running as a guest OS on an IPv6-enabled machine. We also look for
+        // the alternative IPv4 configuration.
+        if (inetAddress.isLoopbackAddress()) {
+          if (ipv4Fallback != null) {
+            inetAddress = ipv4Fallback;
+            useIPv6Addresses = false;
+          } else if (ipv6Fallback != null) {
+            inetAddress = ipv6Fallback;
+            useIPv6Addresses = true;
+          }
+        }
+      }
+    } catch (UnknownHostException ignored) {
+    }
+    localHost = inetAddress;
+  }
+
+
+  /**
+   * returns a set of the non-loopback InetAddresses for this machine
+   */
+  public static Set<InetAddress> getMyAddresses() {
+    Set<InetAddress> result = new HashSet<>();
+    Set<InetAddress> locals = new HashSet<>();
+    Enumeration<NetworkInterface> interfaces;
+    try {
+      interfaces = NetworkInterface.getNetworkInterfaces();
+    } catch (SocketException e) {
+      throw new IllegalArgumentException(
+          "Unable to examine network interfaces",
+          e);
+    }
+    while (interfaces.hasMoreElements()) {
+      NetworkInterface face = interfaces.nextElement();
+      boolean faceIsUp = false;
+      try {
+        faceIsUp = face.isUp();
+      } catch (SocketException e) {
+        // since it's not usable we'll skip this interface
+      }
+      if (faceIsUp) {
+        Enumeration<InetAddress> addrs = face.getInetAddresses();
+        while (addrs.hasMoreElements()) {
+          InetAddress addr = addrs.nextElement();
+          if (addr.isLoopbackAddress() || addr.isAnyLocalAddress()
+              || (!useLinkLocalAddresses && addr.isLinkLocalAddress())) {
+            locals.add(addr);
+          } else {
+            result.add(addr);
+          }
+        } // while
+      }
+    } // while
+    // fix for bug #42427 - allow product to run on a standalone box by using
+    // local addresses if there are no non-local addresses available
+    if (result.size() == 0) {
+      return locals;
+    } else {
+      return result;
+    }
+  }
+
+  /**
+   * This method uses JNDI to look up an address in DNS and return its name
+   *
+   *
+   * @return the host name associated with the address or null if lookup isn't possible or there is
+   *         no host name for this address
+   */
+  private static String reverseDNS(InetAddress addr) {
+    byte[] addrBytes = addr.getAddress();
+    // reverse the address suitable for reverse lookup
+    StringBuilder lookup = new StringBuilder();
+    for (int index = addrBytes.length - 1; index >= 0; index--) {
+      lookup.append(addrBytes[index] & 0xff).append('.');
+    }
+    lookup.append("in-addr.arpa");
+
+    try {
+      Hashtable<String, String> env = new Hashtable<>();
+      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
+      DirContext ctx = new InitialDirContext(env);
+      Attributes attrs = ctx.getAttributes(lookup.toString(), new String[] {"PTR"});
+      for (NamingEnumeration ae = attrs.getAll(); ae.hasMoreElements();) {
+        Attribute attr = (Attribute) ae.next();
+        for (Enumeration vals = attr.getAll(); vals.hasMoreElements();) {
+          Object elem = vals.nextElement();
+          if ("PTR".equals(attr.getID()) && elem != null) {
+            return elem.toString();
+          }
+        }
+      }
+      ctx.close();
+    } catch (Exception e) {
+      // ignored
+    }
+    return null;
+  }
+
+  /**
+   * All classes should use this instead of relying on the JRE system property
+   */
+  public static boolean preferIPv6Addresses() {
+    return useIPv6Addresses;
+  }
+
+  /**
+   * All GemFire code should use this method instead of InetAddress.getLocalHost(). See bug #40619
+   */
+  public static InetAddress getLocalHost() throws UnknownHostException {
+    if (localHost == null) {
+      throw new UnknownHostException();
+    }
+    return localHost;
+  }
+
+  /**
+   * Returns true if host matches the LOCALHOST.
+   */
+  public static boolean isLocalHost(Object host) {
+    if (host instanceof InetAddress) {
+      InetAddress inetAddress = (InetAddress) host;
+      if (isLocalHost(inetAddress)) {
+        return true;
+      } else if (inetAddress.isLoopbackAddress()) {
+        return true;
+      } else {
+        try {
+          Enumeration en = NetworkInterface.getNetworkInterfaces();
+          while (en.hasMoreElements()) {
+            NetworkInterface i = (NetworkInterface) en.nextElement();
+            for (Enumeration en2 = i.getInetAddresses(); en2.hasMoreElements();) {
+              InetAddress addr = (InetAddress) en2.nextElement();
+              if (inetAddress.equals(addr)) {
+                return true;
+              }
+            }
+          }
+          return false;
+        } catch (SocketException e) {
+          throw new IllegalArgumentException("Unable to query network interface", e);
+        }
+      }
+    } else {
+      return isLocalHost((Object) toInetAddress(host.toString()));
+    }
+  }
+
+  private static boolean isLocalHost(InetAddress host) {
+    try {
+      return getLocalHost().equals(host);
+    } catch (UnknownHostException ignored) {
+      return false;
+    }
+  }
+
+  /**
+   * Converts the string host to an instance of InetAddress. Returns null if the string is empty.
+   * Fails Assertion if the conversion would result in <code>java.lang.UnknownHostException</code>.
+   * <p>
+   * Any leading slashes on host will be ignored.
+   *
+   * @param host string version the InetAddress
+   *
+   * @return the host converted to InetAddress instance
+   *
+   * @throws IllegalArgumentException in lieu of UnknownHostException
+   */
+  public static InetAddress toInetAddress(String host) {
+    if (host == null || host.length() == 0) {
+      return null;
+    }
+    try {
+      final int index = host.indexOf("/");
+      if (index > -1) {
+        return InetAddress.getByName(host.substring(index + 1));
+      } else {
+        return InetAddress.getByName(host);
+      }
+    } catch (UnknownHostException e) {
+      throw new IllegalArgumentException(e.getMessage());
+    }
+  }
+}
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java
index 5bf8db3..4bf80f0 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/DistributedSystemDUnitTest.java
@@ -34,7 +34,7 @@ import static org.apache.geode.internal.AvailablePort.MULTICAST;
 import static org.apache.geode.internal.AvailablePort.SOCKET;
 import static org.apache.geode.internal.AvailablePort.getRandomAvailablePort;
 import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPortRange;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.apache.geode.test.dunit.DistributedTestUtils.getDUnitLocatorPort;
 import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/HostedLocatorsDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/HostedLocatorsDUnitTest.java
index ed061de..bdc3e40 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/HostedLocatorsDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/HostedLocatorsDUnitTest.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.distributed;
 
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
 import static org.apache.geode.test.dunit.Assert.assertEquals;
 import static org.apache.geode.test.dunit.Assert.assertFalse;
@@ -31,16 +31,16 @@ import java.util.concurrent.Callable;
 
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.springframework.shell.support.util.FileUtils;
 
 import org.apache.geode.distributed.AbstractLauncher.Status;
 import org.apache.geode.distributed.LocatorLauncher.Builder;
 import org.apache.geode.distributed.LocatorLauncher.LocatorState;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
-import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.InternalLocator;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.util.StopWatch;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.SerializableCallable;
@@ -71,6 +71,12 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase {
     disconnectAllFromDS();
   }
 
+  private String getUniqueLocatorName() {
+    String uniqueLocatorName = Host.getHost(0).getHostName() + "_"
+        + getUniqueName();
+    return uniqueLocatorName;
+  }
+
   @Test
   public void testGetAllHostedLocators() throws Exception {
     final InternalDistributedSystem system = getSystem();
@@ -80,37 +86,33 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase {
 
     final int[] ports = getRandomAvailableTCPPorts(4);
 
-    final String uniqueName = getUniqueName();
+    final String uniqueName = getUniqueLocatorName();
     for (int i = 0; i < 4; i++) {
       final int whichvm = i;
       getHost(0).getVM(whichvm).invoke(new SerializableCallable() {
         @Override
         public Object call() throws Exception {
-          try {
-            System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "locators", dunitLocator);
-            System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0");
-
-            final String name = uniqueName + "-" + whichvm;
-            final File subdir = new File(name);
-            subdir.mkdir();
-            assertTrue(subdir.exists() && subdir.isDirectory());
-
-            final Builder builder = new Builder().setMemberName(name).setPort(ports[whichvm])
-                .setRedirectOutput(true).setWorkingDirectory(name);
-
-            launcher = builder.build();
-            assertEquals(Status.ONLINE, launcher.start().getStatus());
-            waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, 10, true);
-            return null;
-          } finally {
-            System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "locators");
-            System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT);
+          final String name = uniqueName + "-" + whichvm;
+          final File subdir = new File(name);
+          if (subdir.exists()) {
+            FileUtils.deleteRecursively(subdir);
           }
+          subdir.mkdir();
+          assertTrue(subdir.exists() && subdir.isDirectory());
+
+          final Builder builder = new Builder().setMemberName(name).setPort(ports[whichvm])
+              .set(LOCATORS, dunitLocator)
+              .setRedirectOutput(true).setWorkingDirectory(name);
+
+          launcher = builder.build();
+          assertEquals(Status.ONLINE, launcher.start().getStatus());
+          waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, 10, true);
+          return null;
         }
       });
     }
 
-    final String host = SocketCreator.getLocalHost().getHostAddress();
+    final String host = LocalHostUtil.getLocalHost().getHostAddress();
 
     final Set<String> locators = new HashSet<String>();
     locators.add(host + "["
@@ -198,38 +200,34 @@ public class HostedLocatorsDUnitTest extends JUnit4DistributedTestCase {
     // This will eventually contain the ports used by locators
     final int[] ports = new int[] {0, 0, 0, 0};
 
-    final String uniqueName = getUniqueName();
+    final String uniqueName = getUniqueLocatorName();
     for (int i = 0; i < 4; i++) {
       final int whichvm = i;
       Integer port = (Integer) Host.getHost(0).getVM(whichvm).invoke(new SerializableCallable() {
         @Override
         public Object call() throws Exception {
-          try {
-            System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "locators", dunitLocator);
-            System.setProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT, "0");
-
-            final String name = uniqueName + "-" + whichvm;
-            final File subdir = new File(name);
-            subdir.mkdir();
-            assertTrue(subdir.exists() && subdir.isDirectory());
-
-            final Builder builder = new Builder().setMemberName(name).setPort(ports[whichvm])
-                .setRedirectOutput(true).setWorkingDirectory(name);
-
-            launcher = builder.build();
-            assertEquals(Status.ONLINE, launcher.start().getStatus());
-            waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, 10, true);
-            return launcher.getPort();
-          } finally {
-            System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "locators");
-            System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + MCAST_PORT);
+          final String name = uniqueName + "-" + whichvm;
+          final File subdir = new File(name);
+          if (subdir.exists()) {
+            FileUtils.deleteRecursively(subdir);
           }
+          subdir.mkdir();
+          assertTrue(subdir.exists() && subdir.isDirectory());
+
+          final Builder builder = new Builder().setMemberName(name).setPort(ports[whichvm])
+              .set(LOCATORS, dunitLocator)
+              .setRedirectOutput(true).setWorkingDirectory(name);
+
+          launcher = builder.build();
+          assertEquals(Status.ONLINE, launcher.start().getStatus());
+          waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, 10, true);
+          return launcher.getPort();
         }
       });
       ports[i] = port;
     }
 
-    final String host = SocketCreator.getLocalHost().getHostAddress();
+    final String host = LocalHostUtil.getLocalHost().getHostAddress();
 
     final Set<String> locators = new HashSet<String>();
     locators.add(host + "["
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherLocalIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherLocalIntegrationTest.java
index 3fddd44..56f4051 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherLocalIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherLocalIntegrationTest.java
@@ -22,7 +22,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_AUTO_
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.catchThrowable;
 
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
index aa83c35..40c5d53 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.distributed;
 import static org.apache.geode.distributed.AbstractLauncher.Status.NOT_RESPONDING;
 import static org.apache.geode.distributed.AbstractLauncher.Status.ONLINE;
 import static org.apache.geode.distributed.AbstractLauncher.Status.STOPPED;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.catchThrowable;
 
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherLocalIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherLocalIntegrationTest.java
index 2158630..d3f3d30 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherLocalIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherLocalIntegrationTest.java
@@ -22,7 +22,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
 import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.catchThrowable;
 
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
index 8ef565a..198a6ec 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
@@ -19,7 +19,7 @@ import static org.apache.geode.distributed.AbstractLauncher.Status.ONLINE;
 import static org.apache.geode.distributed.AbstractLauncher.Status.STOPPED;
 import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
 import static org.apache.geode.distributed.internal.DistributionConfig.GEMFIRE_PREFIX;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.catchThrowable;
 
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
index 67a16e8..7ccbdf0 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
@@ -77,7 +77,7 @@ import org.apache.geode.distributed.internal.tcpserver.TcpClient;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreatorFactory;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.security.SecurityService;
@@ -142,7 +142,7 @@ public class MembershipJUnitTest {
 
       // boot up a locator
       int port = AvailablePortHelper.getRandomAvailableTCPPort();
-      InetAddress localHost = SocketCreator.getLocalHost();
+      InetAddress localHost = LocalHostUtil.getLocalHost();
 
       // this locator will hook itself up with the first Membership
       // to be created
@@ -321,7 +321,7 @@ public class MembershipJUnitTest {
 
       // boot up a locator
       int port = AvailablePortHelper.getRandomAvailableTCPPort();
-      InetAddress localHost = SocketCreator.getLocalHost();
+      InetAddress localHost = LocalHostUtil.getLocalHost();
       Properties p = new Properties();
       p.setProperty(ConfigurationProperties.SECURITY_UDP_DHALGO, "AES:128");
       // this locator will hook itself up with the first Membership
@@ -447,7 +447,7 @@ public class MembershipJUnitTest {
     assertEquals(24000, sc.getJoinTimeout());
 
     nonDefault.clear();
-    nonDefault.put(LOCATORS, SocketCreator.getLocalHost().getHostAddress() + "[" + 12345 + "]");
+    nonDefault.put(LOCATORS, LocalHostUtil.getLocalHost().getHostAddress() + "[" + 12345 + "]");
     config = new DistributionConfigImpl(nonDefault);
     transport = new RemoteTransportConfig(config, ClusterDistributionManager.NORMAL_DM_TYPE);
     sc = new ServiceConfig(transport, config);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MemberIdentifierFactoryImplTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MemberIdentifierFactoryImplTest.java
index fce1eff..72ec14e 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MemberIdentifierFactoryImplTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MemberIdentifierFactoryImplTest.java
@@ -28,7 +28,7 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.distributed.internal.membership.gms.api.MemberData;
 import org.apache.geode.distributed.internal.membership.gms.api.MemberDataBuilder;
 import org.apache.geode.distributed.internal.membership.gms.api.MemberIdentifier;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.serialization.Version;
 
 public class MemberIdentifierFactoryImplTest {
@@ -42,7 +42,7 @@ public class MemberIdentifierFactoryImplTest {
 
   @Test
   public void testRemoteHost() throws UnknownHostException {
-    InetAddress localhost = SocketCreator.getLocalHost();
+    InetAddress localhost = LocalHostUtil.getLocalHost();
     MemberData memberData =
         MemberDataBuilder.newBuilder(localhost, localhost.getHostName()).build();
     MemberIdentifier data = factory.create(memberData);
@@ -52,7 +52,7 @@ public class MemberIdentifierFactoryImplTest {
 
   @Test
   public void testNewBuilderForLocalHost() throws UnknownHostException {
-    InetAddress localhost = SocketCreator.getLocalHost();
+    InetAddress localhost = LocalHostUtil.getLocalHost();
     MemberData memberData = MemberDataBuilder.newBuilderForLocalHost("hostname").build();
     MemberIdentifier data = factory.create(memberData);
     assertThat(data.getInetAddress()).isEqualTo(localhost);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryIntegrationTest.java
index f0226fe..be5fc80 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryIntegrationTest.java
@@ -60,7 +60,7 @@ import org.apache.geode.distributed.internal.tcpserver.TcpClient;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreatorFactory;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.serialization.DSFIDSerializer;
@@ -162,7 +162,7 @@ public class GMSLocatorRecoveryIntegrationTest {
   @Test
   public void testRecoverFromOther() throws Exception {
     int port = AvailablePortHelper.getRandomAvailableTCPPort();
-    InetAddress localHost = SocketCreator.getLocalHost();
+    InetAddress localHost = LocalHostUtil.getLocalHost();
 
     // this locator will hook itself up with the first Membership to be created
     locator = InternalLocator.startLocator(port, null, null, null, localHost, false,
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
index 8659c67..481313e 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
@@ -14,11 +14,16 @@
  */
 package org.apache.geode.internal.net;
 
-import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_CIPHERS;
-import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_ENABLED;
-import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_PROTOCOLS;
-import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_REQUIRE_AUTHENTICATION;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
+import static org.apache.geode.internal.security.SecurableCommunicationChannel.ALL;
 import static org.apache.geode.internal.security.SecurableCommunicationChannel.CLUSTER;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -60,8 +65,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
 import org.junit.rules.ErrorCollector;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.TestName;
@@ -70,10 +73,10 @@ import org.apache.geode.distributed.internal.DMStats;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionConfigImpl;
 import org.apache.geode.internal.ByteBufferOutputStream;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.tcp.ByteBufferInputStream;
 import org.apache.geode.test.dunit.IgnoredException;
-import org.apache.geode.test.junit.categories.MembershipTest;
 
 /**
  * Integration tests for SocketCreatorFactory with SSL.
@@ -83,7 +86,6 @@ import org.apache.geode.test.junit.categories.MembershipTest;
  *
  * @see ClientSocketFactoryIntegrationTest
  */
-@Category({MembershipTest.class})
 public class SSLSocketIntegrationTest {
 
   private static final String MESSAGE = SSLSocketIntegrationTest.class.getName() + " Message";
@@ -101,9 +103,6 @@ public class SSLSocketIntegrationTest {
   public ErrorCollector errorCollector = new ErrorCollector();
 
   @Rule
-  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
-  @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   @Rule
@@ -114,33 +113,37 @@ public class SSLSocketIntegrationTest {
 
   @Before
   public void setUp() throws Exception {
+    SocketCreatorFactory.close(); // ensure nothing lingers from past tests
+
     IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Read timed out");
 
     File keystore = findTestKeystore();
-    System.setProperty("javax.net.ssl.trustStore", keystore.getCanonicalPath());
-    System.setProperty("javax.net.ssl.trustStorePassword", "password");
-    System.setProperty("javax.net.ssl.keyStore", keystore.getCanonicalPath());
-    System.setProperty("javax.net.ssl.keyStorePassword", "password");
     // System.setProperty("javax.net.debug", "ssl,handshake");
 
 
     Properties properties = new Properties();
     properties.setProperty(MCAST_PORT, "0");
-    properties.setProperty(CLUSTER_SSL_ENABLED, "true");
-    properties.setProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION, "true");
-    properties.setProperty(CLUSTER_SSL_CIPHERS, "any");
-    properties.setProperty(CLUSTER_SSL_PROTOCOLS, "TLSv1.2");
+    properties.setProperty(SSL_ENABLED_COMPONENTS, ALL.getConstant());
+    properties.setProperty(SSL_KEYSTORE, keystore.getCanonicalPath());
+    properties.setProperty(SSL_KEYSTORE_PASSWORD, "password");
+    properties.setProperty(SSL_TRUSTSTORE, keystore.getCanonicalPath());
+    properties.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
+    properties.setProperty(SSL_REQUIRE_AUTHENTICATION, "true");
+    properties.setProperty(SSL_CIPHERS, "any");
+    properties.setProperty(SSL_PROTOCOLS, "TLSv1.2");
 
     this.distributionConfig = new DistributionConfigImpl(properties);
 
     SocketCreatorFactory.setDistributionConfig(this.distributionConfig);
-    this.socketCreator = SocketCreatorFactory.getSocketCreatorForComponent(CLUSTER);
+    this.socketCreator =
+        SocketCreatorFactory.getSocketCreatorForComponent(this.distributionConfig, CLUSTER);
 
-    this.localHost = InetAddress.getLocalHost();
+    this.localHost = LocalHostUtil.getLocalHost();
   }
 
   @After
   public void tearDown() throws Exception {
+    SocketCreatorFactory.close();
     if (this.clientSocket != null) {
       this.clientSocket.close();
     }
@@ -150,7 +153,6 @@ public class SSLSocketIntegrationTest {
     if (this.serverThread != null && this.serverThread.isAlive()) {
       this.serverThread.interrupt();
     }
-    SocketCreatorFactory.close();
   }
 
   @Test
@@ -372,7 +374,7 @@ public class SSLSocketIntegrationTest {
     // a client SSL socket to it and demonstrate that the
     // handshake times out
     final ServerSocket serverSocket = new ServerSocket();
-    serverSocket.bind(new InetSocketAddress(SocketCreator.getLocalHost(), 0));
+    serverSocket.bind(new InetSocketAddress(LocalHostUtil.getLocalHost(), 0));
     Thread serverThread = new Thread() {
       @Override
       public void run() {
@@ -406,7 +408,7 @@ public class SSLSocketIntegrationTest {
       await("connect to server socket").until(() -> {
         try {
           Socket clientSocket = socketCreator.connectForClient(
-              SocketCreator.getLocalHost().getHostAddress(), serverSocketPort, 500);
+              LocalHostUtil.getLocalHost().getHostAddress(), serverSocketPort, 500);
           clientSocket.close();
           System.err.println(
               "client successfully connected to server but should not have been able to do so");
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java
index e49dff3..ffe275a 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/GemFireStatSamplerIntegrationTest.java
@@ -33,8 +33,8 @@ import static org.apache.geode.internal.GemFireVersion.getGemFireVersion;
 import static org.apache.geode.internal.GemFireVersion.getSourceDate;
 import static org.apache.geode.internal.cache.control.HeapMemoryMonitor.getTenuredMemoryPoolMXBean;
 import static org.apache.geode.internal.cache.control.HeapMemoryMonitor.getTenuredPoolStatistics;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.apache.geode.internal.net.SocketCreator.getHostName;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
 import static org.apache.geode.internal.statistics.HostStatSampler.TEST_FILE_SIZE_LIMIT_IN_KB_PROPERTY;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/SimpleStatSamplerIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/SimpleStatSamplerIntegrationTest.java
index e5d2df9..c8b7040 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/SimpleStatSamplerIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/SimpleStatSamplerIntegrationTest.java
@@ -35,6 +35,7 @@ import org.junit.rules.TestName;
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.Statistics;
 import org.apache.geode.StatisticsType;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.stats50.VMStats50;
 import org.apache.geode.test.junit.categories.StatisticsTest;
@@ -99,7 +100,7 @@ public class SimpleStatSamplerIntegrationTest extends StatSamplerTestCase {
     assertTrue(statsCount > 0);
 
     assertTrue(statSampler.getSystemStartTime() <= System.currentTimeMillis());
-    assertEquals(SocketCreator.getHostName(SocketCreator.getLocalHost()),
+    assertEquals(SocketCreator.getHostName(LocalHostUtil.getLocalHost()),
         statSampler.getSystemDirectoryPath());
 
     VMStatsContract vmStats = statSampler.getVMStats();
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/FederatingManagerConcurrencyIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/FederatingManagerConcurrencyIntegrationTest.java
index 4be6b4a..2efe96e 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/FederatingManagerConcurrencyIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/FederatingManagerConcurrencyIntegrationTest.java
@@ -15,7 +15,7 @@
 package org.apache.geode.management.internal;
 
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.apache.geode.management.internal.SystemManagementService.FEDERATING_MANAGER_FACTORY_PROPERTY;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java b/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
index a790ca2..976adb3 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/GemFireMemberStatus.java
@@ -45,7 +45,7 @@ import org.apache.geode.internal.cache.PartitionedRegionStatus;
 import org.apache.geode.internal.cache.RegionStatus;
 import org.apache.geode.internal.cache.tier.InternalClientMembership;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 
 /**
  * Class <code>GemFireMemberStatus</code> provides the status of a specific GemFire member VM. This
@@ -616,7 +616,7 @@ public class GemFireMemberStatus implements Serializable {
     setUpTime(System.currentTimeMillis() - ids.getStartTime());
     try {
       setHostAddress((bindAddress != null && bindAddress.length() > 0)
-          ? InetAddress.getByName(bindAddress) : SocketCreator.getLocalHost());
+          ? InetAddress.getByName(bindAddress) : LocalHostUtil.getLocalHost());
     } catch (IOException e) {
       /* ignore - leave null host address */}
   }
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java
index d57e64d..c34aa10 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java
@@ -42,7 +42,7 @@ import org.apache.geode.internal.admin.Stat;
 import org.apache.geode.internal.admin.StatAlertDefinition;
 import org.apache.geode.internal.admin.StatListener;
 import org.apache.geode.internal.admin.StatResource;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.logging.internal.executors.LoggingThread;
 import org.apache.geode.logging.internal.log4j.api.LogService;
 
@@ -204,7 +204,7 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM {
   @Override
   public java.net.InetAddress getHost() {
     try {
-      return SocketCreator.getLocalHost();
+      return LocalHostUtil.getLocalHost();
 
     } catch (Exception ex) {
       throw new org.apache.geode.InternalGemFireException(
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/ManagedEntityConfigImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/ManagedEntityConfigImpl.java
index f67cb62..540981a 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/ManagedEntityConfigImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/ManagedEntityConfigImpl.java
@@ -24,6 +24,7 @@ import java.net.UnknownHostException;
 import org.apache.geode.admin.ManagedEntityConfig;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.admin.GemFireVM;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 
 /**
@@ -61,7 +62,7 @@ public abstract class ManagedEntityConfigImpl implements ManagedEntityConfig {
    */
   protected static String getLocalHostName() {
     try {
-      return SocketCreator.getLocalHost().getCanonicalHostName();
+      return LocalHostUtil.getLocalHost().getCanonicalHostName();
 
     } catch (UnknownHostException ex) {
       IllegalStateException ex2 = new IllegalStateException(
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/Locator.java b/geode-core/src/main/java/org/apache/geode/distributed/Locator.java
index 413651f..01e2b66 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/Locator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/Locator.java
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 
 /**
@@ -385,7 +386,7 @@ public abstract class Locator {
     Object ba = this.bindAddress;
     if (ba == null) {
       try {
-        ba = SocketCreator.getHostName(SocketCreator.getLocalHost());
+        ba = SocketCreator.getHostName(LocalHostUtil.getLocalHost());
       } catch (java.net.UnknownHostException uh) {
       }
     }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index f219cc4..d6ec7cc 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -68,6 +68,7 @@ import org.apache.geode.internal.DistributionLocator;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.lang.ObjectUtils;
 import org.apache.geode.internal.net.SSLConfigurationFactory;
 import org.apache.geode.internal.net.SocketCreator;
@@ -448,7 +449,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
         return getBindAddress().getCanonicalHostName();
       }
 
-      InetAddress localhost = SocketCreator.getLocalHost();
+      InetAddress localhost = LocalHostUtil.getLocalHost();
 
       return localhost.getCanonicalHostName();
     } catch (UnknownHostException handled) {
@@ -1591,7 +1592,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
       } else {
         try {
           InetAddress address = InetAddress.getByName(bindAddress);
-          if (SocketCreator.isLocalHost(address)) {
+          if (LocalHostUtil.isLocalHost(address)) {
             this.bindAddress = address;
             return this;
           } else {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index 88691f3..9447dff 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -80,8 +80,8 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.tier.sockets.CacheServerHelper;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.process.ConnectionFailedException;
 import org.apache.geode.internal.process.ControlNotificationHandler;
 import org.apache.geode.internal.process.ControllableProcess;
@@ -562,7 +562,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
         return getServerBindAddress().getCanonicalHostName();
       }
 
-      final InetAddress localhost = SocketCreator.getLocalHost();
+      final InetAddress localhost = LocalHostUtil.getLocalHost();
 
       return localhost.getCanonicalHostName();
     } catch (UnknownHostException handled) {
@@ -2105,7 +2105,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
       // NOTE only set the 'bind address' if the user specified a value
       try {
         InetAddress bindAddress = InetAddress.getByName(serverBindAddress);
-        if (SocketCreator.isLocalHost(bindAddress)) {
+        if (LocalHostUtil.isLocalHost(bindAddress)) {
           this.serverBindAddress = bindAddress;
           serverBindAddressSetByUser = true;
           return this;
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/AbstractDistributionConfig.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/AbstractDistributionConfig.java
index 3cab2ef..905bec9 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/AbstractDistributionConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/AbstractDistributionConfig.java
@@ -207,8 +207,8 @@ import org.apache.geode.annotations.Immutable;
 import org.apache.geode.internal.AbstractConfig;
 import org.apache.geode.internal.ConfigSource;
 import org.apache.geode.internal.admin.remote.DistributionLocatorId;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.LogWriterImpl;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.logging.internal.log4j.LogLevel;
 import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -325,22 +325,22 @@ public abstract class AbstractDistributionConfig extends AbstractConfig
 
   @ConfigAttributeChecker(name = BIND_ADDRESS)
   protected String checkBindAddress(String value) {
-    if (value != null && value.length() > 0 && !SocketCreator.isLocalHost(value)) {
+    if (value != null && value.length() > 0 && !LocalHostUtil.isLocalHost(value)) {
       throw new IllegalArgumentException(
           String.format(
               "The bind-address %s is not a valid address for this machine.  These are the valid addresses for this machine: %s",
-              value, SocketCreator.getMyAddresses()));
+              value, LocalHostUtil.getMyAddresses()));
     }
     return value;
   }
 
   @ConfigAttributeChecker(name = SERVER_BIND_ADDRESS)
   protected String checkServerBindAddress(String value) {
-    if (value != null && value.length() > 0 && !SocketCreator.isLocalHost(value)) {
+    if (value != null && value.length() > 0 && !LocalHostUtil.isLocalHost(value)) {
       throw new IllegalArgumentException(
           String.format(
               "The bind-address %s is not a valid address for this machine.  These are the valid addresses for this machine: %s",
-              value, SocketCreator.getMyAddresses()));
+              value, LocalHostUtil.getMyAddresses()));
     }
     return value;
   }
@@ -357,11 +357,11 @@ public abstract class AbstractDistributionConfig extends AbstractConfig
 
   @ConfigAttributeChecker(name = HTTP_SERVICE_BIND_ADDRESS)
   protected String checkHttpServiceBindAddress(String value) {
-    if (value != null && value.length() > 0 && !SocketCreator.isLocalHost(value)) {
+    if (value != null && value.length() > 0 && !LocalHostUtil.isLocalHost(value)) {
       throw new IllegalArgumentException(
           String.format(
               "The bind-address %s is not a valid address for this machine.  These are the valid addresses for this machine: %s",
-              value, SocketCreator.getMyAddresses()));
+              value, LocalHostUtil.getMyAddresses()));
     }
     return value;
   }
@@ -656,22 +656,22 @@ public abstract class AbstractDistributionConfig extends AbstractConfig
 
   @ConfigAttributeChecker(name = MEMCACHED_BIND_ADDRESS)
   protected String checkMemcachedBindAddress(String value) {
-    if (value != null && value.length() > 0 && !SocketCreator.isLocalHost(value)) {
+    if (value != null && value.length() > 0 && !LocalHostUtil.isLocalHost(value)) {
       throw new IllegalArgumentException(
           String.format(
               "The memcached-bind-address %s is not a valid address for this machine.  These are the valid addresses for this machine: %s",
-              value, SocketCreator.getMyAddresses()));
+              value, LocalHostUtil.getMyAddresses()));
     }
     return value;
   }
 
   @ConfigAttributeChecker(name = REDIS_BIND_ADDRESS)
   protected String checkRedisBindAddress(String value) {
-    if (value != null && value.length() > 0 && !SocketCreator.isLocalHost(value)) {
+    if (value != null && value.length() > 0 && !LocalHostUtil.isLocalHost(value)) {
       throw new IllegalArgumentException(
           String.format(
               "The redis-bind-address %s is not a valid address for this machine.  These are the valid addresses for this machine: %s",
-              value, SocketCreator.getMyAddresses()));
+              value, LocalHostUtil.getMyAddresses()));
     }
     return value;
   }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
index bd195f3..82fb8ef 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java
@@ -77,9 +77,9 @@ import org.apache.geode.internal.admin.remote.RemoteGfManagerAgent;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
 import org.apache.geode.internal.cache.InitialImageOperation;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.monitoring.ThreadsMonitoring;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.sequencelog.MembershipLogger;
 import org.apache.geode.internal.serialization.Version;
 import org.apache.geode.internal.tcp.ConnectionTable;
@@ -1576,7 +1576,7 @@ public class ClusterDistributionManager implements DistributionManager {
       // no network interface
       equivs = new HashSet<>();
       try {
-        equivs.add(SocketCreator.getLocalHost());
+        equivs.add(LocalHostUtil.getLocalHost());
       } catch (UnknownHostException e) {
         // can't even get localhost
         if (getViewMembers().size() > 1) {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
index c1a772b..c194ee1 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfigImpl.java
@@ -88,6 +88,7 @@ import org.apache.geode.GemFireIOException;
 import org.apache.geode.InternalGemFireException;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.ConfigSource;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.process.ProcessLauncherContext;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
@@ -1768,7 +1769,7 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement
         return bindAddress + "[" + startLocatorPort + "]";
       }
       try {
-        return SocketCreator.getHostName(SocketCreator.getLocalHost()) + "[" + startLocatorPort
+        return SocketCreator.getHostName(LocalHostUtil.getLocalHost()) + "[" + startLocatorPort
             + "]";
       } catch (UnknownHostException ignore) {
         // punt and use this.startLocator instead
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index e4a0ecb..e341b68 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -77,9 +77,9 @@ import org.apache.geode.internal.cache.InternalCacheBuilder;
 import org.apache.geode.internal.cache.tier.sockets.TcpServerFactory;
 import org.apache.geode.internal.cache.wan.WANServiceProvider;
 import org.apache.geode.internal.config.JAXBService;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.InternalLogWriter;
 import org.apache.geode.internal.logging.LogWriterFactory;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.net.SocketCreatorFactory;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.statistics.StatisticsConfig;
@@ -666,7 +666,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
       if (bindAddress != null) {
         sb.append(bindAddress.getHostAddress());
       } else {
-        sb.append(SocketCreator.getLocalHost().getHostAddress());
+        sb.append(LocalHostUtil.getLocalHost().getHostAddress());
       }
       sb.append('[').append(getPort()).append(']');
       String thisLocator = sb.toString();
@@ -1317,7 +1317,7 @@ public class InternalLocator extends Locator implements ConnectListener, LogConf
   public void onConnect(InternalDistributedSystem sys) {
     try {
       locatorStats.hookupStats(sys,
-          SocketCreator.getLocalHost().getCanonicalHostName() + '-' + server.getBindAddress());
+          LocalHostUtil.getLocalHost().getCanonicalHostName() + '-' + server.getBindAddress());
     } catch (UnknownHostException e) {
       logger.warn(e);
     }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
index d9d181c..3638a25 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
@@ -49,6 +49,7 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.distributed.internal.membership.gms.api.MemberDataBuilder;
 import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.InternalLogWriter;
 import org.apache.geode.internal.monitoring.ThreadsMonitoring;
 import org.apache.geode.internal.monitoring.ThreadsMonitoringImpl;
@@ -1204,7 +1205,7 @@ public class LonerDistributionManager implements DistributionManager {
 
       String name = this.system.getName();
 
-      InetAddress hostAddr = SocketCreator.getLocalHost();
+      InetAddress hostAddr = LocalHostUtil.getLocalHost();
       host = SocketCreator.use_client_host_name ? hostAddr.getCanonicalHostName()
           : hostAddr.getHostAddress();
       DistributionConfig config = system.getConfig();
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocation.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocation.java
index 0c90289..54b10cf 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocation.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocation.java
@@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.geode.DataSerializable;
 import org.apache.geode.DataSerializer;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 
 /**
  * Represents the location of a cache server. This class is preferable to InetSocketAddress because
@@ -112,7 +112,7 @@ public class ServerLocation implements DataSerializable, Comparable {
     } else if (!hostName.equals(other.hostName)) {
       String canonicalHostName;
       try {
-        canonicalHostName = SocketCreator.getLocalHost().getCanonicalHostName();
+        canonicalHostName = LocalHostUtil.getLocalHost().getCanonicalHostName();
       } catch (UnknownHostException e) {
         throw new IllegalStateException("getLocalHost failed with " + e);
       }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
index 5ff5dde..5240b82 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
@@ -55,7 +55,7 @@ import org.apache.geode.internal.cache.ControllerAdvisor;
 import org.apache.geode.internal.cache.ControllerAdvisor.ControllerProfile;
 import org.apache.geode.internal.cache.FindDurableQueueProcessor;
 import org.apache.geode.internal.cache.GridAdvisor.GridProfile;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.serialization.DataSerializableFixedID;
 import org.apache.geode.logging.internal.log4j.api.LogService;
 
@@ -94,7 +94,7 @@ public class ServerLocator implements RestartableTcpHandler, DistributionAdvisee
 
   ServerLocator() throws IOException {
     this.port = 10334;
-    this.hostName = SocketCreator.getLocalHost().getCanonicalHostName();
+    this.hostName = LocalHostUtil.getLocalHost().getCanonicalHostName();
     this.hostNameForClients = this.hostName;
     this.logFile = null;
     this.memberName = null;
@@ -113,7 +113,7 @@ public class ServerLocator implements RestartableTcpHandler, DistributionAdvisee
     this.port = port;
 
     if (bindAddress == null) {
-      this.hostName = SocketCreator.getLocalHost().getCanonicalHostName();
+      this.hostName = LocalHostUtil.getLocalHost().getCanonicalHostName();
     } else {
       this.hostName = bindAddress.getHostAddress();
     }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java
index 9c14bb3..d4a2bc7 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/StartupMessage.java
@@ -33,7 +33,7 @@ import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.InternalDataSerializer.SerializerAttributesHolder;
 import org.apache.geode.internal.InternalInstantiator;
 import org.apache.geode.internal.InternalInstantiator.InstantiatorAttributesHolder;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.serialization.DeserializationContext;
 import org.apache.geode.internal.serialization.SerializationContext;
 import org.apache.geode.internal.serialization.Version;
@@ -69,7 +69,7 @@ public class StartupMessage extends DistributionMessage implements AdminMessageT
    */
   public static Set<InetAddress> getMyAddresses(ClusterDistributionManager dm) {
     try {
-      return SocketCreator.getMyAddresses();
+      return LocalHostUtil.getMyAddresses();
     } catch (IllegalArgumentException e) {
       logger.fatal(e.getMessage(), e);
       return Collections.emptySet();
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
index ed92af6..6fcf531 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
@@ -49,8 +49,8 @@ import org.apache.geode.distributed.internal.membership.gms.api.MemberShunnedExc
 import org.apache.geode.distributed.internal.membership.gms.api.Membership;
 import org.apache.geode.distributed.internal.membership.gms.api.MessageListener;
 import org.apache.geode.internal.cache.DirectReplyMessage;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.log4j.LogMarker;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.tcp.BaseMsgStreamer;
 import org.apache.geode.internal.tcp.ConnectExceptions;
 import org.apache.geode.internal.tcp.Connection;
@@ -795,7 +795,7 @@ public class DirectChannel {
         return InetAddress.getByName(bindAddress);
 
       } else {
-        return SocketCreator.getLocalHost();
+        return LocalHostUtil.getLocalHost();
       }
     } catch (java.net.UnknownHostException unhe) {
       throw new RuntimeException(unhe);
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
index c9d6955..1c5dfd0 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/InternalDistributedMember.java
@@ -49,6 +49,7 @@ import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.InternalDataSerializer;
 import org.apache.geode.internal.OSProcess;
 import org.apache.geode.internal.cache.versions.VersionSource;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.serialization.DataSerializableFixedID;
 import org.apache.geode.internal.serialization.DeserializationContext;
@@ -141,9 +142,9 @@ public class InternalDistributedMember
     memberData.setProcessId(OSProcess.getId());
     try {
       if (SocketCreator.resolve_dns) {
-        memberData.setHostName(SocketCreator.getHostName(SocketCreator.getLocalHost()));
+        memberData.setHostName(SocketCreator.getHostName(LocalHostUtil.getLocalHost()));
       } else {
-        memberData.setHostName(SocketCreator.getLocalHost().getHostAddress());
+        memberData.setHostName(LocalHostUtil.getLocalHost().getHostAddress());
       }
     } catch (UnknownHostException ee) {
       throw new InternalGemFireError(ee);
@@ -280,7 +281,7 @@ public class InternalDistributedMember
    */
   public InternalDistributedMember(String host, int p, String n, String u, int vmKind,
       String[] groups, DurableClientAttributes attr) throws UnknownHostException {
-    InetAddress addr = SocketCreator.toInetAddress(host);
+    InetAddress addr = LocalHostUtil.toInetAddress(host);
     MemberDataBuilder builder = MemberDataBuilder.newBuilder(addr, host)
         .setName(n)
         .setMembershipPort(p)
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/TcpSocketCreatorAdapter.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/TcpSocketCreatorAdapter.java
index 09be3e2..f3c1724 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/TcpSocketCreatorAdapter.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/adapter/TcpSocketCreatorAdapter.java
@@ -24,6 +24,7 @@ import java.util.Objects;
 
 import org.apache.geode.distributed.internal.tcpserver.ConnectionWatcher;
 import org.apache.geode.distributed.internal.tcpserver.TcpSocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 
 /**
@@ -62,7 +63,7 @@ public class TcpSocketCreatorAdapter implements TcpSocketCreator {
 
   @Override
   public InetAddress getLocalHost() throws UnknownHostException {
-    return SocketCreator.getLocalHost();
+    return LocalHostUtil.getLocalHost();
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSUtil.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSUtil.java
index 0708de3..69edc05 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSUtil.java
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.distributed.internal.membership.gms.api.MemberIdentifier;
 import org.apache.geode.distributed.internal.membership.gms.api.MembershipConfigurationException;
 import org.apache.geode.distributed.internal.membership.gms.membership.HostAddress;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.serialization.DeserializationContext;
 import org.apache.geode.internal.serialization.SerializationContext;
 import org.apache.geode.internal.serialization.StaticSerialization;
@@ -53,7 +53,7 @@ public class GMSUtil {
 
     try {
       if (bindAddress == null || bindAddress.trim().length() == 0) {
-        addr = SocketCreator.getLocalHost();
+        addr = LocalHostUtil.getLocalHost();
       } else {
         addr = InetAddress.getByName(bindAddress);
       }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/AvailablePort.java b/geode-core/src/main/java/org/apache/geode/internal/AvailablePort.java
index cda0877..cebbd39 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/AvailablePort.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/AvailablePort.java
@@ -33,7 +33,7 @@ import java.util.Random;
 
 import org.apache.geode.annotations.Immutable;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 
 /**
  * This class determines whether or not a given port is available and can also provide a randomly
@@ -108,7 +108,7 @@ public class AvailablePort {
       MulticastSocket socket = null;
       try {
         socket = new MulticastSocket();
-        InetAddress localHost = SocketCreator.getLocalHost();
+        InetAddress localHost = LocalHostUtil.getLocalHost();
         socket.setInterface(localHost);
         socket.setSoTimeout(Integer.getInteger("AvailablePort.timeout", 2000).intValue());
         socket.setReuseAddress(true);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/VersionDescription.java b/geode-core/src/main/java/org/apache/geode/internal/VersionDescription.java
index 686f16c..89f87f9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/VersionDescription.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/VersionDescription.java
@@ -26,7 +26,7 @@ import java.util.Optional;
 import java.util.Properties;
 import java.util.TreeMap;
 
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 
 public class VersionDescription {
   public static final String RESOURCE_NAME = "GemFireVersion.properties";
@@ -138,7 +138,7 @@ public class VersionDescription {
 
   private static String getLocalHost() {
     try {
-      return SocketCreator.getLocalHost().toString();
+      return LocalHostUtil.getLocalHost().toString();
     } catch (UnknownHostException e) {
       return e.getMessage();
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DistributionLocatorId.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DistributionLocatorId.java
index 066cce6..c6f0874 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DistributionLocatorId.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DistributionLocatorId.java
@@ -29,6 +29,7 @@ import org.apache.geode.InternalGemFireException;
 import org.apache.geode.distributed.Locator;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreator;
 
 /**
@@ -70,7 +71,7 @@ public class DistributionLocatorId implements java.io.Serializable {
 
   public DistributionLocatorId(int port, String bindAddress, String hostnameForClients) {
     try {
-      this.host = SocketCreator.getLocalHost();
+      this.host = LocalHostUtil.getLocalHost();
     } catch (UnknownHostException ex) {
       throw new InternalGemFireException(
           "Failed getting local host", ex);
@@ -356,7 +357,7 @@ public class DistributionLocatorId implements java.io.Serializable {
 
   /**
    * Converts a collection of {@link Locator} instances to a collection of DistributionLocatorId
-   * instances. Note this will use {@link SocketCreator#getLocalHost()} as the host for
+   * instances. Note this will use {@link LocalHostUtil#getLocalHost()} as the host for
    * DistributionLocatorId. This is because all instances of Locator are local only.
    *
    * @param locators collection of Locator instances
@@ -371,7 +372,7 @@ public class DistributionLocatorId implements java.io.Serializable {
     Collection<DistributionLocatorId> locatorIds = new ArrayList<DistributionLocatorId>();
     for (Locator locator : locators) {
       DistributionLocatorId locatorId =
-          new DistributionLocatorId(SocketCreator.getLocalHost(), locator);
+          new DistributionLocatorId(LocalHostUtil.getLocalHost(), locator);
       locatorIds.add(locatorId);
     }
     return locatorIds;
@@ -379,7 +380,7 @@ public class DistributionLocatorId implements java.io.Serializable {
 
   /**
    * Marshals a collection of {@link Locator} instances to a collection of DistributionLocatorId
-   * instances. Note this will use {@link SocketCreator#getLocalHost()} as the host for
+   * instances. Note this will use {@link LocalHostUtil#getLocalHost()} as the host for
    * DistributionLocatorId. This is because all instances of Locator are local only.
    *
    * @param locatorIds collection of DistributionLocatorId instances
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
index 2af8f31..04f693b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
@@ -31,7 +31,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.serialization.DeserializationContext;
 import org.apache.geode.internal.serialization.SerializationContext;
 import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -74,7 +74,7 @@ public class FetchHostResponse extends AdminResponse {
         // handled in the finally block
       } finally {
         if (host == null) {
-          host = SocketCreator.getLocalHost();
+          host = LocalHostUtil.getLocalHost();
         }
       }
       m.host = host;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 57836f5..ad31848 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -244,6 +244,7 @@ import org.apache.geode.internal.cache.xmlcache.CacheXmlParser;
 import org.apache.geode.internal.cache.xmlcache.CacheXmlPropertyResolver;
 import org.apache.geode.internal.cache.xmlcache.PropertyResolver;
 import org.apache.geode.internal.config.ClusterConfigurationNotAvailableException;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.jndi.JNDIInvoker;
 import org.apache.geode.internal.jta.TransactionManagerImpl;
 import org.apache.geode.internal.lang.ThrowableUtils;
@@ -2766,7 +2767,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
   private PoolFactory createDefaultPF() {
     PoolFactory defaultPoolFactory = PoolManager.createFactory();
     try {
-      String localHostName = SocketCreator.getHostName(SocketCreator.getLocalHost());
+      String localHostName = SocketCreator.getHostName(LocalHostUtil.getLocalHost());
       defaultPoolFactory.addServer(localHostName, CacheServer.DEFAULT_PORT);
     } catch (UnknownHostException ex) {
       throw new IllegalStateException("Could not determine local host name", ex);
@@ -2791,7 +2792,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
     if (poolFactoryImpl.getPoolAttributes().locators.isEmpty()
         && poolFactoryImpl.getPoolAttributes().servers.isEmpty()) {
       try {
-        String localHostName = SocketCreator.getHostName(SocketCreator.getLocalHost());
+        String localHostName = SocketCreator.getHostName(LocalHostUtil.getLocalHost());
         poolFactoryImpl.addServer(localHostName, CacheServer.DEFAULT_PORT);
       } catch (UnknownHostException ex) {
         throw new IllegalStateException("Could not determine local host name", ex);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PersistentBucketRecoverer.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PersistentBucketRecoverer.java
index b6d4d59..9f228fd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PersistentBucketRecoverer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PersistentBucketRecoverer.java
@@ -38,7 +38,7 @@ import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.ProxyBucketRegion;
 import org.apache.geode.internal.cache.persistence.PersistentMemberID;
 import org.apache.geode.internal.cache.persistence.PersistentStateListener;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.process.StartupStatus;
 import org.apache.geode.internal.util.TransformUtils;
 import org.apache.geode.logging.internal.executors.LoggingThread;
@@ -291,7 +291,7 @@ public class PersistentBucketRecoverer extends RecoveryRunnable implements Persi
         InetAddress localHost = null;
 
         try {
-          localHost = SocketCreator.getLocalHost();
+          localHost = LocalHostUtil.getLocalHost();
         } catch (UnknownHostException e) {
           logger.error("Could not determine my own host", e);
         }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
index 6663051..831c08c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
@@ -89,6 +89,7 @@ import org.apache.geode.internal.cache.tier.OverflowAttributes;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier.CacheClientNotifierProvider;
 import org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor.ClientHealthMonitorProvider;
 import org.apache.geode.internal.cache.wan.GatewayReceiverStats;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.CoreLoggingExecutors;
 import org.apache.geode.internal.monitoring.ThreadsMonitoring;
 import org.apache.geode.internal.net.SocketCreator;
@@ -1199,7 +1200,7 @@ public class AcceptorImpl implements Acceptor, Runnable {
   public String getServerName() {
     String name = serverSock.getLocalSocketAddress().toString();
     try {
-      name = SocketCreator.getLocalHost().getCanonicalHostName() + "-" + name;
+      name = LocalHostUtil.getLocalHost().getCanonicalHostName() + "-" + name;
     } catch (Exception e) {
     }
     return name;
@@ -1786,7 +1787,7 @@ public class AcceptorImpl implements Acceptor, Runnable {
     }
     if (needCanonicalHostName) {
       try {
-        result = SocketCreator.getLocalHost().getCanonicalHostName();
+        result = LocalHostUtil.getLocalHost().getCanonicalHostName();
       } catch (UnknownHostException ex) {
         throw new IllegalStateException("getLocalHost failed with " + ex);
       }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/InetAddressUtils.java b/geode-core/src/main/java/org/apache/geode/internal/net/InetAddressUtils.java
index 79d1f3e..be25a02 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/net/InetAddressUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/InetAddressUtils.java
@@ -22,6 +22,7 @@ import java.util.Enumeration;
 
 import org.apache.geode.GemFireIOException;
 import org.apache.geode.annotations.Immutable;
+import org.apache.geode.internal.inet.LocalHostUtil;
 
 /**
  * Provides static utilities for manipulating, validating, and converting InetAddresses and host
@@ -34,7 +35,7 @@ public class InetAddressUtils {
   private static final InetAddress LOCALHOST = getLocalHost();
 
   private static final String LOOPBACK_ADDRESS =
-      SocketCreator.preferIPv6Addresses() ? "::1" : "127.0.0.1";
+      LocalHostUtil.preferIPv6Addresses() ? "::1" : "127.0.0.1";
 
   @Immutable
   private static final InetAddress LOOPBACK = toInetAddress(LOOPBACK_ADDRESS);
@@ -221,7 +222,7 @@ public class InetAddressUtils {
    */
   private static InetAddress getLocalHost() {
     try {
-      return SocketCreator.getLocalHost();
+      return LocalHostUtil.getLocalHost();
     } catch (UnknownHostException e) {
       throw new AssertionError("Failed to get local host", e);
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java
index 1983d8e..97f56cb 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java
@@ -19,11 +19,8 @@ import java.io.Console;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.BindException;
-import java.net.Inet4Address;
-import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
-import java.net.NetworkInterface;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketAddress;
@@ -42,22 +39,12 @@ import java.security.PrivateKey;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ThreadLocalRandom;
 
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
 import javax.net.ServerSocketFactory;
 import javax.net.SocketFactory;
 import javax.net.ssl.KeyManager;
@@ -87,12 +74,12 @@ import org.apache.geode.cache.wan.GatewayTransportFilter;
 import org.apache.geode.distributed.ClientSocketFactory;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.DistributionConfigImpl;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.tcpserver.ConnectionWatcher;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.admin.SSLConfig;
 import org.apache.geode.internal.cache.wan.TransportFilterServerSocket;
 import org.apache.geode.internal.cache.wan.TransportFilterSocketFactory;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.util.ArgumentRedactor;
 import org.apache.geode.internal.util.PasswordUtil;
 import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -121,30 +108,6 @@ public class SocketCreator {
 
   private static final Logger logger = LogService.getLogger();
 
-  /**
-   * Optional system property to enable GemFire usage of link-local addresses
-   */
-  private static final String USE_LINK_LOCAL_ADDRESSES_PROPERTY =
-      DistributionConfig.GEMFIRE_PREFIX + "net.useLinkLocalAddresses";
-
-  /**
-   * True if GemFire should use link-local addresses
-   */
-  private static final boolean useLinkLocalAddresses =
-      Boolean.getBoolean(USE_LINK_LOCAL_ADDRESSES_PROPERTY);
-
-  /**
-   * we cache localHost to avoid bug #40619, access-violation in native code
-   */
-  private static final InetAddress localHost;
-
-  /**
-   * all classes should use this variable to determine whether to use IPv4 or IPv6 addresses
-   */
-  @MakeNotStatic
-  private static boolean useIPv6Addresses = !Boolean.getBoolean("java.net.preferIPv4Stack")
-      && Boolean.getBoolean("java.net.preferIPv6Addresses");
-
   @MakeNotStatic
   private static final ConcurrentHashMap<InetAddress, String> hostNames = new ConcurrentHashMap<>();
 
@@ -183,57 +146,6 @@ public class SocketCreator {
 
   private final SSLConfig sslConfig;
 
-  static {
-    InetAddress inetAddress = null;
-    try {
-      inetAddress = InetAddress.getByAddress(InetAddress.getLocalHost().getAddress());
-      if (inetAddress.isLoopbackAddress()) {
-        InetAddress ipv4Fallback = null;
-        InetAddress ipv6Fallback = null;
-        // try to find a non-loopback address
-        Set<InetAddress> myInterfaces = getMyAddresses();
-        boolean preferIPv6 = SocketCreator.useIPv6Addresses;
-        String lhName = null;
-        for (InetAddress addr : myInterfaces) {
-          if (addr.isLoopbackAddress() || addr.isAnyLocalAddress() || lhName != null) {
-            break;
-          }
-          boolean ipv6 = addr instanceof Inet6Address;
-          boolean ipv4 = addr instanceof Inet4Address;
-          if ((preferIPv6 && ipv6) || (!preferIPv6 && ipv4)) {
-            String addrName = reverseDNS(addr);
-            if (inetAddress.isLoopbackAddress()) {
-              inetAddress = addr;
-              lhName = addrName;
-            } else if (addrName != null) {
-              inetAddress = addr;
-              lhName = addrName;
-            }
-          } else {
-            if (preferIPv6 && ipv4 && ipv4Fallback == null) {
-              ipv4Fallback = addr;
-            } else if (!preferIPv6 && ipv6 && ipv6Fallback == null) {
-              ipv6Fallback = addr;
-            }
-          }
-        }
-        // vanilla Ubuntu installations will have a usable IPv6 address when
-        // running as a guest OS on an IPv6-enabled machine. We also look for
-        // the alternative IPv4 configuration.
-        if (inetAddress.isLoopbackAddress()) {
-          if (ipv4Fallback != null) {
-            inetAddress = ipv4Fallback;
-            SocketCreator.useIPv6Addresses = false;
-          } else if (ipv6Fallback != null) {
-            inetAddress = ipv6Fallback;
-            SocketCreator.useIPv6Addresses = true;
-          }
-        }
-      }
-    } catch (UnknownHostException ignored) {
-    }
-    localHost = inetAddress;
-  }
 
   /**
    * A factory used to create client <code>Sockets</code>.
@@ -277,20 +189,10 @@ public class SocketCreator {
   // -------------------------------------------------------------------------
 
   /**
-   * All GemFire code should use this method instead of InetAddress.getLocalHost(). See bug #40619
+   * @deprecated use LocalHostUtil.getLocalHost()
    */
   public static InetAddress getLocalHost() throws UnknownHostException {
-    if (localHost == null) {
-      throw new UnknownHostException();
-    }
-    return localHost;
-  }
-
-  /**
-   * All classes should use this instead of relying on the JRE system property
-   */
-  public static boolean preferIPv6Addresses() {
-    return SocketCreator.useIPv6Addresses;
+    return LocalHostUtil.getLocalHost();
   }
 
   /**
@@ -1170,153 +1072,4 @@ public class SocketCreator {
         .setGatewayTransportFilters(sender.getGatewayTransportFilters());
   }
 
-  /**
-   * returns a set of the non-loopback InetAddresses for this machine
-   */
-  public static Set<InetAddress> getMyAddresses() {
-    Set<InetAddress> result = new HashSet<>();
-    Set<InetAddress> locals = new HashSet<>();
-    Enumeration<NetworkInterface> interfaces;
-    try {
-      interfaces = NetworkInterface.getNetworkInterfaces();
-    } catch (SocketException e) {
-      throw new IllegalArgumentException(
-          "Unable to examine network interfaces",
-          e);
-    }
-    while (interfaces.hasMoreElements()) {
-      NetworkInterface face = interfaces.nextElement();
-      boolean faceIsUp = false;
-      try {
-        faceIsUp = face.isUp();
-      } catch (SocketException e) {
-        InternalDistributedSystem ids = InternalDistributedSystem.getAnyInstance();
-        if (ids != null) {
-          logger.info("Failed to check if network interface is up. Skipping {}", face, e);
-        }
-      }
-      if (faceIsUp) {
-        Enumeration<InetAddress> addrs = face.getInetAddresses();
-        while (addrs.hasMoreElements()) {
-          InetAddress addr = addrs.nextElement();
-          if (addr.isLoopbackAddress() || addr.isAnyLocalAddress()
-              || (!useLinkLocalAddresses && addr.isLinkLocalAddress())) {
-            locals.add(addr);
-          } else {
-            result.add(addr);
-          }
-        } // while
-      }
-    } // while
-    // fix for bug #42427 - allow product to run on a standalone box by using
-    // local addresses if there are no non-local addresses available
-    if (result.size() == 0) {
-      return locals;
-    } else {
-      return result;
-    }
-  }
-
-  /**
-   * This method uses JNDI to look up an address in DNS and return its name
-   *
-   *
-   * @return the host name associated with the address or null if lookup isn't possible or there is
-   *         no host name for this address
-   */
-  private static String reverseDNS(InetAddress addr) {
-    byte[] addrBytes = addr.getAddress();
-    // reverse the address suitable for reverse lookup
-    StringBuilder lookup = new StringBuilder();
-    for (int index = addrBytes.length - 1; index >= 0; index--) {
-      lookup.append(addrBytes[index] & 0xff).append('.');
-    }
-    lookup.append("in-addr.arpa");
-
-    try {
-      Hashtable<String, String> env = new Hashtable<>();
-      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
-      DirContext ctx = new InitialDirContext(env);
-      Attributes attrs = ctx.getAttributes(lookup.toString(), new String[] {"PTR"});
-      for (NamingEnumeration ae = attrs.getAll(); ae.hasMoreElements();) {
-        Attribute attr = (Attribute) ae.next();
-        for (Enumeration vals = attr.getAll(); vals.hasMoreElements();) {
-          Object elem = vals.nextElement();
-          if ("PTR".equals(attr.getID()) && elem != null) {
-            return elem.toString();
-          }
-        }
-      }
-      ctx.close();
-    } catch (Exception e) {
-      // ignored
-    }
-    return null;
-  }
-
-  /**
-   * Returns true if host matches the LOCALHOST.
-   */
-  public static boolean isLocalHost(Object host) {
-    if (host instanceof InetAddress) {
-      InetAddress inetAddress = (InetAddress) host;
-      if (isLocalHost(inetAddress)) {
-        return true;
-      } else if (inetAddress.isLoopbackAddress()) {
-        return true;
-      } else {
-        try {
-          Enumeration en = NetworkInterface.getNetworkInterfaces();
-          while (en.hasMoreElements()) {
-            NetworkInterface i = (NetworkInterface) en.nextElement();
-            for (Enumeration en2 = i.getInetAddresses(); en2.hasMoreElements();) {
-              InetAddress addr = (InetAddress) en2.nextElement();
-              if (inetAddress.equals(addr)) {
-                return true;
-              }
-            }
-          }
-          return false;
-        } catch (SocketException e) {
-          throw new IllegalArgumentException("Unable to query network interface", e);
-        }
-      }
-    } else {
-      return isLocalHost((Object) toInetAddress(host.toString()));
-    }
-  }
-
-  private static boolean isLocalHost(InetAddress host) {
-    try {
-      return SocketCreator.getLocalHost().equals(host);
-    } catch (UnknownHostException ignored) {
-      return false;
-    }
-  }
-
-  /**
-   * Converts the string host to an instance of InetAddress. Returns null if the string is empty.
-   * Fails Assertion if the conversion would result in <code>java.lang.UnknownHostException</code>.
-   * <p>
-   * Any leading slashes on host will be ignored.
-   *
-   * @param host string version the InetAddress
-   *
-   * @return the host converted to InetAddress instance
-   */
-  public static InetAddress toInetAddress(String host) {
-    if (host == null || host.length() == 0) {
-      return null;
-    }
-    try {
-      final int index = host.indexOf("/");
-      if (index > -1) {
-        return InetAddress.getByName(host.substring(index + 1));
-      } else {
-        return InetAddress.getByName(host);
-      }
-    } catch (java.net.UnknownHostException e) {
-      throw new IllegalArgumentException(e.getMessage());
-    }
-  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
index da43cb7..9cc53f8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java
@@ -28,6 +28,7 @@ import org.apache.geode.Statistics;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.NanoTimer;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.io.MainWithChildrenRollingFileHandler;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.net.SocketCreator;
@@ -152,7 +153,7 @@ public abstract class HostStatSampler
   @Override
   public String getSystemDirectoryPath() {
     try {
-      return SocketCreator.getHostName(SocketCreator.getLocalHost());
+      return SocketCreator.getHostName(LocalHostUtil.getLocalHost());
     } catch (UnknownHostException ignore) {
       return "";
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/OsStatisticsProvider.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/OsStatisticsProvider.java
index 6fe356a..06d1bad 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/OsStatisticsProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/OsStatisticsProvider.java
@@ -18,8 +18,8 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 
 import org.apache.geode.Statistics;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.lang.SystemUtils;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.statistics.platform.LinuxProcFsStatistics;
 import org.apache.geode.internal.statistics.platform.LinuxProcessStats;
 import org.apache.geode.internal.statistics.platform.LinuxSystemStats;
@@ -134,7 +134,7 @@ public class OsStatisticsProvider {
   private String getHostSystemName() {
     String hostname = "unknownHostName";
     try {
-      InetAddress inetAddress = SocketCreator.getLocalHost();
+      InetAddress inetAddress = LocalHostUtil.getLocalHost();
       hostname = inetAddress.getCanonicalHostName();
     } catch (UnknownHostException ignored) {
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
index cefbe6f..20001b1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
@@ -40,6 +40,7 @@ import org.apache.geode.StatisticDescriptor;
 import org.apache.geode.annotations.internal.MakeNotStatic;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.NanoTimer;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -203,7 +204,7 @@ public class StatArchiveWriter implements StatArchiveFormat, SampleHandler {
   protected String getMachineInfo() {
     String machineInfo = System.getProperty("os.arch");
     try {
-      String hostName = SocketCreator.getHostName(SocketCreator.getLocalHost());
+      String hostName = SocketCreator.getHostName(LocalHostUtil.getLocalHost());
       machineInfo += " " + hostName;
     } catch (UnknownHostException ignore) {
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
index a5a53fd..0639bc1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
@@ -50,6 +50,7 @@ import org.apache.geode.distributed.internal.direct.DirectChannel;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.membership.gms.api.MemberShunnedException;
 import org.apache.geode.distributed.internal.membership.gms.api.Membership;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.log4j.LogMarker;
 import org.apache.geode.internal.net.BufferPool;
 import org.apache.geode.internal.net.SocketCreator;
@@ -239,7 +240,7 @@ public class TCPConduit implements Runnable {
 
     if (address == null) {
       try {
-        SocketCreator.getLocalHost();
+        LocalHostUtil.getLocalHost();
       } catch (UnknownHostException e) {
         throw new ConnectionException("Unable to resolve localHost address", e);
       }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerAdvisee.java b/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerAdvisee.java
index 292e9d4..9eb8ea3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerAdvisee.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/JmxManagerAdvisee.java
@@ -25,8 +25,8 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.admin.SSLConfig;
 import org.apache.geode.internal.cache.InternalCacheForClientAccess;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SSLConfigurationFactory;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.internal.JmxManagerAdvisor.JmxManagerProfile;
@@ -127,7 +127,7 @@ public class JmxManagerAdvisee implements DistributionAdvisee {
         }
         if (host == null || host.equals("")) {
           try {
-            host = SocketCreator.getLocalHost().getHostAddress(); // fixes 46317
+            host = LocalHostUtil.getLocalHost().getHostAddress(); // fixes 46317
           } catch (UnknownHostException ex) {
             host = "127.0.0.1";
           }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index 62dd471..0638ada 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -56,6 +56,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.admin.SSLConfig;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SSLConfigurationFactory;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.net.SocketCreatorFactory;
@@ -288,7 +289,7 @@ public class ManagementAgent {
     } else if (StringUtils.isNotBlank(bindAddress)) {
       return InetAddress.getByName(bindAddress).getHostAddress();
     } else {
-      return SocketCreator.getLocalHost().getHostAddress();
+      return LocalHostUtil.getLocalHost().getHostAddress();
     }
   }
 
@@ -310,7 +311,7 @@ public class ManagementAgent {
     final String hostname;
     final InetAddress bindAddr;
     if (StringUtils.isBlank(this.config.getJmxManagerBindAddress())) {
-      hostname = SocketCreator.getLocalHost().getHostName();
+      hostname = LocalHostUtil.getLocalHost().getHostName();
       bindAddr = null;
     } else {
       hostname = this.config.getJmxManagerBindAddress();
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
index eedb4cc..84cce29 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
@@ -34,7 +34,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.InternalRegionArguments;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.logging.internal.log4j.api.LogService;
 
@@ -132,9 +132,9 @@ public class RestAgent {
       return bindAddress;
 
     try {
-      bindAddress = SocketCreator.getLocalHost().getHostAddress();
+      bindAddress = LocalHostUtil.getLocalHost().getHostAddress();
       logger.info("RestAgent.getBindAddressForHttpService.localhost: "
-          + SocketCreator.getLocalHost().getHostAddress());
+          + LocalHostUtil.getLocalHost().getHostAddress());
     } catch (UnknownHostException e) {
       logger.error("LocalHost could not be found.", e);
     }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
index 96d0b6c..5daa606 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
@@ -68,8 +68,8 @@ import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionStats;
 import org.apache.geode.internal.cache.control.ResourceManagerStats;
 import org.apache.geode.internal.cache.execute.metrics.FunctionServiceStats;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.logging.log4j.LogMarker;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.offheap.MemoryAllocator;
 import org.apache.geode.internal.offheap.OffHeapMemoryStats;
 import org.apache.geode.internal.process.PidUnavailableException;
@@ -212,7 +212,7 @@ public class MemberMBeanBridge {
     initGemfireProperties();
 
     try {
-      hostname = SocketCreator.getLocalHost().getHostName();
+      hostname = LocalHostUtil.getLocalHost().getHostName();
     } catch (UnknownHostException ignore) {
       hostname = ManagementConstants.DEFAULT_HOST_NAME;
     }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/util/HostUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/util/HostUtils.java
index a7b38a4..992e814 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/util/HostUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/util/HostUtils.java
@@ -20,15 +20,15 @@ import java.net.UnknownHostException;
 
 import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.internal.DistributionLocator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.net.SocketCreator;
 
 public class HostUtils {
   private static final String LOCALHOST = "localhost";
 
   public static String getLocalHost() {
     try {
-      return SocketCreator.getLocalHost().getCanonicalHostName();
+      return LocalHostUtil.getLocalHost().getCanonicalHostName();
     } catch (UnknownHostException ignore) {
       return LOCALHOST;
     }
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageDataJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageDataJUnitTest.java
index 63e4248..83678c6 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageDataJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/StartupMessageDataJUnitTest.java
@@ -33,7 +33,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.internal.ByteArrayData;
 import org.apache.geode.internal.admin.remote.DistributionLocatorId;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.test.junit.categories.MembershipTest;
 
 /**
@@ -254,7 +254,7 @@ public class StartupMessageDataJUnitTest {
 
   private String createOneLocatorString() throws Exception {
     DistributionLocatorId locatorId =
-        new DistributionLocatorId(SocketCreator.getLocalHost(), 44556, "111.222.333.444", null);
+        new DistributionLocatorId(LocalHostUtil.getLocalHost(), 44556, "111.222.333.444", null);
     String locatorString = locatorId.marshal();
     assertEquals("" + locatorId.getHost().getAddress().getHostAddress() + ":111.222.333.444[44556]",
         locatorString);
@@ -267,7 +267,7 @@ public class StartupMessageDataJUnitTest {
       int j = i + 1;
       int k = j + 1;
       int l = k + 1;
-      DistributionLocatorId locatorId = new DistributionLocatorId(SocketCreator.getLocalHost(),
+      DistributionLocatorId locatorId = new DistributionLocatorId(LocalHostUtil.getLocalHost(),
           445566, "" + i + "" + i + "" + i + "." + j + "" + j + "" + j + "." + k + "" + k + "" + k
               + "." + l + "" + l + "" + l,
           null);
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
index c55b080..9e9b1d0 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
@@ -32,7 +32,7 @@ import org.apache.geode.distributed.Locator;
 import org.apache.geode.distributed.internal.LocatorStats;
 import org.apache.geode.distributed.internal.membership.adapter.LocalViewMessage;
 import org.apache.geode.internal.OSProcess;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.util.JavaWorkarounds;
 
@@ -94,6 +94,7 @@ public class MembershipDependenciesJUnitTest {
               .or(resideInAPackage("org.apache.geode.logging.internal.log4j.api.."))
               .or(resideInAPackage("org.apache.geode.logging.internal.executors.."))
               .or(resideInAPackage("org.apache.geode.distributed.internal.tcpserver.."))
+              .or(type(LocalHostUtil.class))
 
               .or(not(resideInAPackage("org.apache.geode..")))
 
@@ -106,9 +107,6 @@ public class MembershipDependenciesJUnitTest {
               // TODO: break dependencies on locator-related classes
               .or(type(Locator.class))
 
-              // TODO:
-              .or(type(SocketCreator.class))
-
               // TODO: break dependency on internal.security
               .or(type(SecurableCommunicationChannel.class))
 
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipViewJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipViewJUnitTest.java
index b613c81..997ae14 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipViewJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipViewJUnitTest.java
@@ -33,7 +33,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.membership.gms.GMSMembershipView;
 import org.apache.geode.distributed.internal.membership.gms.api.MemberIdentifier;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.test.junit.categories.MembershipTest;
 
 @Category({MembershipTest.class})
@@ -46,7 +46,7 @@ public class MembershipViewJUnitTest {
     int numMembers = 10;
     members = new ArrayList<>(numMembers);
     for (int i = 0; i < numMembers; i++) {
-      members.add(new InternalDistributedMember(SocketCreator.getLocalHost(), 1000 + i));
+      members.add(new InternalDistributedMember(LocalHostUtil.getLocalHost(), 1000 + i));
     }
     // view creator is a locator
     members.get(0).setVmKind(ClusterDistributionManager.LOCATOR_DM_TYPE);
@@ -183,7 +183,7 @@ public class MembershipViewJUnitTest {
 
     int oldSize = view.size();
     for (int i = 0; i < 100; i++) {
-      MemberIdentifier mbr = new InternalDistributedMember(SocketCreator.getLocalHost(), 2000 + i);
+      MemberIdentifier mbr = new InternalDistributedMember(LocalHostUtil.getLocalHost(), 2000 + i);
       mbr.setVmKind(ClusterDistributionManager.NORMAL_DM_TYPE);
       mbr.setVmViewId(2);
       view.add(mbr);
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/adapter/auth/AbstractGMSAuthenticatorTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/adapter/auth/AbstractGMSAuthenticatorTestCase.java
index c88fa3a..b2e7c53 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/adapter/auth/AbstractGMSAuthenticatorTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/adapter/auth/AbstractGMSAuthenticatorTestCase.java
@@ -31,7 +31,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.membership.gms.Services;
 import org.apache.geode.distributed.internal.membership.gms.api.MembershipConfig;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.AuthInitialize;
 import org.apache.geode.security.AuthenticationFailedException;
@@ -64,7 +64,7 @@ public abstract class AbstractGMSAuthenticatorTestCase {
   public void setUp() throws Exception {
     clearStatics();
     MockitoAnnotations.initMocks(this);
-    when(this.member.getInetAddress()).thenReturn(SocketCreator.getLocalHost());
+    when(this.member.getInetAddress()).thenReturn(LocalHostUtil.getLocalHost());
 
     this.props = new Properties();
     this.securityProps = new Properties();
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModelJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModelJUnitTest.java
index b969895..3d5665b 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModelJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/rebalance/PartitionedRegionLoadModelJUnitTest.java
@@ -51,7 +51,7 @@ import org.apache.geode.internal.cache.partitioned.rebalance.BucketOperator.Comp
 import org.apache.geode.internal.cache.partitioned.rebalance.model.AddressComparor;
 import org.apache.geode.internal.cache.partitioned.rebalance.model.PartitionedRegionLoadModel;
 import org.apache.geode.internal.cache.persistence.PersistentMemberID;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 
 @RunWith(JUnitParamsRunner.class)
 public class PartitionedRegionLoadModelJUnitTest {
@@ -207,7 +207,7 @@ public class PartitionedRegionLoadModelJUnitTest {
     InternalDistributedMember member2 =
         new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 2);
     InternalDistributedMember member3 =
-        new InternalDistributedMember(SocketCreator.getLocalHost(), 3);
+        new InternalDistributedMember(LocalHostUtil.getLocalHost(), 3);
 
     // Create some buckets with low redundancy on members 1 and 2
     PartitionMemberInfoImpl details1 =
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionVectorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionVectorTest.java
index 07ca1b0..cdced60 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionVectorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionVectorTest.java
@@ -48,7 +48,7 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.internal.HeapDataOutputStream;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.persistence.DiskStoreID;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.serialization.Version;
 import org.apache.geode.test.junit.rules.ExecutorServiceRule;
 
@@ -1093,7 +1093,7 @@ public class RegionVersionVectorTest {
 
   private static String getIPLiteral() {
     try {
-      return SocketCreator.getLocalHost().getHostAddress();
+      return LocalHostUtil.getLocalHost().getHostAddress();
     } catch (UnknownHostException e) {
       throw new Error("Problem determining host IP address", e);
     }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
index a5dfec8..233de78 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.internal.tcp;
 
-import static org.apache.geode.internal.net.SocketCreator.getLocalHost;
+import static org.apache.geode.internal.inet.LocalHostUtil.getLocalHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.isNull;
diff --git a/geode-memcached/src/main/java/org/apache/geode/memcached/GemFireMemcachedServer.java b/geode-memcached/src/main/java/org/apache/geode/memcached/GemFireMemcachedServer.java
index e796acc..23deda7 100644
--- a/geode-memcached/src/main/java/org/apache/geode/memcached/GemFireMemcachedServer.java
+++ b/geode-memcached/src/main/java/org/apache/geode/memcached/GemFireMemcachedServer.java
@@ -36,6 +36,7 @@ import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.memcached.ConnectionHandler;
 import org.apache.geode.internal.net.SocketCreator;
 
@@ -211,12 +212,12 @@ public class GemFireMemcachedServer {
     acceptor.setDaemon(true);
     acceptor.start();
     latch.await();
-    logger.config("GemFireMemcachedServer server started on host:" + SocketCreator.getLocalHost()
+    logger.config("GemFireMemcachedServer server started on host:" + LocalHostUtil.getLocalHost()
         + " port: " + this.serverPort);
   }
 
   private InetAddress getBindAddress() throws UnknownHostException {
-    return this.bindAddress == null || this.bindAddress.isEmpty() ? SocketCreator.getLocalHost()
+    return this.bindAddress == null || this.bindAddress.isEmpty() ? LocalHostUtil.getLocalHost()
         : InetAddress.getByName(this.bindAddress);
   }
 
diff --git a/geode-redis/src/distributedTest/java/org/apache/geode/redis/RedisDistDUnitTest.java b/geode-redis/src/distributedTest/java/org/apache/geode/redis/RedisDistDUnitTest.java
index 236b84c..b834481 100644
--- a/geode-redis/src/distributedTest/java/org/apache/geode/redis/RedisDistDUnitTest.java
+++ b/geode-redis/src/distributedTest/java/org/apache/geode/redis/RedisDistDUnitTest.java
@@ -28,7 +28,7 @@ import redis.clients.jedis.Jedis;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.DistributedTestUtils;
 import org.apache.geode.test.dunit.Host;
@@ -71,7 +71,7 @@ public class RedisDistDUnitTest extends JUnit4DistributedTestCase {
   public final void postSetUp() throws Exception {
     JUnit4DistributedTestCase.disconnectAllFromDS();
 
-    localHost = SocketCreator.getLocalHost().getHostName();
+    localHost = LocalHostUtil.getLocalHost().getHostName();
 
     host = Host.getHost(0);
     server1 = host.getVM(0);
@@ -86,7 +86,7 @@ public class RedisDistDUnitTest extends JUnit4DistributedTestCase {
       public Object call() throws Exception {
         int port = ports[VM.getCurrentVMNum()];
         CacheFactory cF = new CacheFactory();
-        String locator = SocketCreator.getLocalHost().getHostName() + "[" + locatorPort + "]";
+        String locator = LocalHostUtil.getLocalHost().getHostName() + "[" + locatorPort + "]";
         cF.set(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
         cF.set(ConfigurationProperties.REDIS_BIND_ADDRESS, localHost);
         cF.set(ConfigurationProperties.REDIS_PORT, "" + port);
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServer.java b/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
index 0dfe315..d1fc7a6 100644
--- a/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
@@ -65,7 +65,7 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation;
 import org.apache.geode.internal.hll.HyperLogLogPlus;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.redis.internal.ByteArrayWrapper;
 import org.apache.geode.redis.internal.ByteToCommandDecoder;
 import org.apache.geode.redis.internal.Coder;
@@ -365,7 +365,7 @@ public class GeodeRedisServer {
    * @return The InetAddress to bind to
    */
   private InetAddress getBindAddress() throws UnknownHostException {
-    return this.bindAddress == null || this.bindAddress.isEmpty() ? SocketCreator.getLocalHost()
+    return this.bindAddress == null || this.bindAddress.isEmpty() ? LocalHostUtil.getLocalHost()
         : InetAddress.getByName(this.bindAddress);
   }
 
diff --git a/geode-tcp-server/src/distributedTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerGossipVersionDUnitTest.java b/geode-tcp-server/src/distributedTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerGossipVersionDUnitTest.java
index 6c75c44..a3076aa 100644
--- a/geode-tcp-server/src/distributedTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerGossipVersionDUnitTest.java
+++ b/geode-tcp-server/src/distributedTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerGossipVersionDUnitTest.java
@@ -35,7 +35,7 @@ import org.apache.geode.distributed.internal.membership.gms.locator.FindCoordina
 import org.apache.geode.distributed.internal.membership.gms.locator.FindCoordinatorResponse;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.internal.net.SocketCreatorFactory;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.serialization.Version;
@@ -152,7 +152,7 @@ public class TcpServerGossipVersionDUnitTest extends JUnit4DistributedTestCase {
                   .getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR)),
           InternalDataSerializer.getDSFIDSerializer().getObjectSerializer(),
           InternalDataSerializer.getDSFIDSerializer().getObjectDeserializer())
-              .requestToServer(SocketCreator.getLocalHost(), port0, req, 5000);
+              .requestToServer(LocalHostUtil.getLocalHost(), port0, req, 5000);
       assertThat(response).isNotNull();
 
     } catch (IllegalStateException e) {
diff --git a/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java b/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
index c240029..55009fc 100644
--- a/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
+++ b/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
@@ -44,7 +44,7 @@ import org.junit.runner.RunWith;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.wan.GatewayReceiver;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.management.internal.i18n.CliStrings;
 import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
@@ -683,7 +683,7 @@ public class CreateGatewayReceiverCommandDUnitTest {
   }
 
   private String getHostName() throws Exception {
-    return SocketCreator.getLocalHost().getCanonicalHostName();
+    return LocalHostUtil.getLocalHost().getCanonicalHostName();
   }
 
   private String getBindAddress() throws Exception {
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
index da74474..b4b5ed6 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
@@ -35,7 +35,7 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.ResourceEvent;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.InternalCacheServer;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.logging.internal.log4j.api.LogService;
 
 /**
@@ -119,7 +119,7 @@ public class GatewayReceiverImpl implements GatewayReceiver {
     }
 
     try {
-      return SocketCreator.getLocalHost().getHostName();
+      return LocalHostUtil.getLocalHost().getHostName();
     } catch (UnknownHostException e) {
       throw new IllegalStateException("Could not get host name", e);
     }
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewayReceiverImplTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewayReceiverImplTest.java
index 5cf6060..db99ce9 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewayReceiverImplTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewayReceiverImplTest.java
@@ -38,7 +38,7 @@ import org.apache.geode.cache.wan.GatewayReceiver;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.InternalCacheServer;
-import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.test.junit.categories.WanTest;
 
 @Category(WanTest.class)
@@ -64,7 +64,7 @@ public class GatewayReceiverImplTest {
     GatewayReceiver gateway = new GatewayReceiverImpl(cache, 2000, 2001, 5, 100, null, null, null,
         true, true, 2000);
 
-    assertThat(gateway.getHost()).isEqualTo(SocketCreator.getLocalHost().getHostName());
+    assertThat(gateway.getHost()).isEqualTo(LocalHostUtil.getLocalHost().getHostName());
   }
 
   @Test


Mime
View raw message