apache/httpcore — pull request #1 by pbkwee (2014-08-06 05:09:53+00:00)
Title: The HttpHost InetAddress constructor will use the InetAddress#getHostNam...

...e (rather than InetAddress#getHostAddress) when provided with an InetAddress.

System.out.println(new HttpHost(InetAddress.getByAddress("127.0.0.1", new byte[] {127,0,0,1}), 80, "http"));
System.out.println(new HttpHost(InetAddress.getByAddress(new byte[] {127,0,0,1}), 80, "http"));
System.out.println(new HttpHost(InetAddress.getByAddress("somehost", new byte[] {127,0,0,1}), 80, "http"));

Produces:
http://127.0.0.1:80
http://localhost:80
http://somehost:80

This ensures that HttpHost#getHostName reflects the name wish to use (rather than the IP address). Which can be important, for example with Cookie domains and HTTP Host: headers.