public static InetAddress getAddressWithSocket(String byConnecting, int port) {
		Socket s = new Socket();
		try {
			if (tryConnection(byConnecting, port, s)) {
				return s.getLocalAddress();
			}
		} finally {
			IOUtils.closeQuietly(s);
		}
		return null;
	}
Get local host name by connecting to a server.

@param byConnecting the server address to connect.
@param port         the port to connect
@return localhost name. if fails, return "localhost"
ngrinder-core/src/main/java/net/grinder/util/NetworkUtils.java