public static boolean isLocalAddress(String targetAddress, int timeoutMs) {
    return getLocalHostName(timeoutMs).equals(targetAddress)
        || getLocalIpAddress(timeoutMs).equals(targetAddress);
  }
@Test
  public void TestisLocalAddress() {
    int resolveTimeout = (int) mConfiguration.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS);
    String localHostName = NetworkAddressUtils.getLocalHostName(resolveTimeout);
    String localIp = NetworkAddressUtils.getLocalIpAddress(resolveTimeout);

    assertTrue(NetworkAddressUtils.isLocalAddress(localHostName, resolveTimeout));
    assertTrue(NetworkAddressUtils.isLocalAddress(localIp, resolveTimeout));

    assertFalse(NetworkAddressUtils.isLocalAddress(localHostName + "false", resolveTimeout));
    assertFalse(NetworkAddressUtils.isLocalAddress(localIp + "false", resolveTimeout));
  }