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 .