docs: private static InetAddress findLocalHostAddress(final String nameToResolve, final boolean preferIPv6) {
          return AccessController.doPrivileged(new PrivilegedAction<InetAddress>() {
              @Override
              @FFDCIgnore({ SocketException.class, UnknownHostException.class })
              public InetAddress run() {
                  InetAddressResult result = new InetAddressResult(preferIPv6);
                  try {
                      // We are checking a configured hostname or IP address. This could be a shortname, like "bob", 
                      // or could be a qualified name like 'was.pok.ibm.com'. If it is "bob", 
                      // there is a possibility of getting something else's ip address back
                      // with a blind getAllByName.
                      InetAddress[] addrs = InetAddress.getAllByName(nameToResolve);
  
                      if (addrs != null) {
                          // This loop makes sure that the host that was specified *can* be resolved back
                          // to a nic on this machine... we don't care why or how (ipv4 vs. ipv6)...
                          for (InetAddress addr : addrs) {
                              if (addr.isLoopbackAddress()) {
                                  // On z/OS, 127.0.0.1 is not correctly matched to the loopback 
                                  // network interface (the call below returns null, see RTC Java Defect 125337). 
                                  // If the addr is a loopback, we know that it is an address local
                                  // to this machine, so we can answer appropriately.
                                  // Try to preserve the IP address preference, for getCanonicalHostName behavior.
                                  if (result.setAddressIsPreferred(addr))
                                      break;
                              } else {
                                  NetworkInterface nic = NetworkInterface.getByInetAddress(addr);
                                  // We found a nic that is bound to the specified hostname/address,
                                  // which means we can use that IP address. Try to find the address
                                  // of the preferred protocol type
                                  if (nic != null) {
                                      if (result.setAddressIsPreferred(addr))
                                          break;
                                  }
                              }
                          }
                      }
                  } catch (SocketException e) {
                  } catch (UnknownHostException e) {
                  }
  
                  return result.getAddress();
              }
          });
      }