docs: private static InetAddress findAddressUsingStrategy(AddressDetectionState strategy,
  														InetSocketAddress targetAddress,
  														boolean logging) throws IOException {
  		// try LOCAL_HOST strategy independent of the network interfaces
  		if (strategy == AddressDetectionState.LOCAL_HOST) {
  			InetAddress localhostName;
  			try {
  				localhostName = InetAddress.getLocalHost();
  			} catch (UnknownHostException uhe) {
  				LOG.warn("Could not resolve local hostname to an IP address: {}", uhe.getMessage());
  				return null;
  			}
  
  			if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) {
  				LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address");
  				// Here, we are not calling tryLocalHostBeforeReturning() because it is the LOCAL_HOST strategy
  				return localhostName;
  			} else {
  				return null;
  			}
  		}
  
  		final InetAddress address = targetAddress.getAddress();
  		if (address == null) {
  			return null;
  		}
  		final byte[] targetAddressBytes = address.getAddress();
  
  		// for each network interface
  		Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
  		while (e.hasMoreElements()) {
  
  			NetworkInterface netInterface = e.nextElement();
  
  			// for each address of the network interface
  			Enumeration<InetAddress> ee = netInterface.getInetAddresses();
  			while (ee.hasMoreElements()) {
  				InetAddress interfaceAddress = ee.nextElement();
  
  				switch (strategy) {
  					case ADDRESS:
  						if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) {
  							LOG.debug("Target address {} and local address {} share prefix - trying to connect.",
  										targetAddress, interfaceAddress);
  
  							if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) {
  								return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging);
  							}
  						}
  						break;
  
  					case FAST_CONNECT:
  					case SLOW_CONNECT:
  						LOG.debug("Trying to connect to {} from local address {} with timeout {}",
  								targetAddress, interfaceAddress, strategy.getTimeout());
  
  						if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) {
  							return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging);
  						}
  						break;
  
  					case HEURISTIC:
  						if (LOG.isDebugEnabled()) {
  							LOG.debug("Choosing InetAddress.getLocalHost() address as a heuristic.");
  						}
  
  						return InetAddress.getLocalHost();
  
  					default:
  						throw new RuntimeException("Unsupported strategy: " + strategy);
  				}
  			} // end for each address of the interface
  		} // end for each interface
  
  		return null;
  	}