public static String hostAndPortToUrlString(String host, int port) throws UnknownHostException {
		return ipAddressAndPortToUrlString(InetAddress.getByName(host), port);
	}
public static String hostAndPortToUrlString ( String host , int port ) throws UnknownHostException { return ipAddressAndPortToUrlString ( InetAddress . getByName ( host ) , port ) ; }
Normalizes and encodes a hostname and port to be included in URL.
In particular, this method makes sure that IPv6 address literals have the proper
formatting to be included in URLs.

@param host The address to be included in the URL.
@param port The port for the URL address.
@return The proper URL string encoded IP address and port.
@throws java.net.UnknownHostException Thrown, if the hostname cannot be translated into a URL.