docs: static String checkLocality(String[] locations, Log log) {
          try {
              InetAddress[] candidates = NetworkUtils.getGlobalInterfaces();
              for (String address : locations) {
                  StringUtils.IpAndPort ipAndPort = StringUtils.parseIpAddress(address);
                  InetAddress addr = InetAddress.getByName(ipAndPort.ip);
                  for (InetAddress candidate : candidates) {
                      if (addr.equals(candidate)) {
                          return address;
                      }
                  }
              }
          } catch (SocketException e) {
              if (log.isDebugEnabled()) {
                  log.debug("Unable to retrieve the global interfaces of the system", e);
              }
          } catch (UnknownHostException e) {
              if (log.isDebugEnabled()) {
                  log.debug("Unable to retrieve IP address", e);
              }
          }
          return null;
      }