HttpHost implements NamedEndpoint, Serializable { @Override public String toString() { return toURI(); } HttpHost(final String scheme, final InetAddress address, final String hostname, final int port);  HttpHost(final String scheme, final String hostname, final int port);  HttpHost(final String hostname, final int port);  HttpHost(final String scheme, final String hostname);  HttpHost(final String hostname);  HttpHost(final String scheme, final InetAddress address, final int port);  HttpHost(final InetAddress address, final int port);  HttpHost(final InetAddress address);  HttpHost(final String scheme, final NamedEndpoint namedEndpoint);  HttpHost(final URIAuthority authority); static HttpHost create(final String s); static HttpHost create(final URI uri); @Override String getHostName(); @Override int getPort(); String getSchemeName(); InetAddress getAddress(); String toURI(); String toHostString(); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); static final URIScheme DEFAULT_SCHEME; }
@Test public void testToString() throws Exception { final HttpHost host1 = new HttpHost("somehost"); Assert.assertEquals("http: final HttpHost host2 = new HttpHost("somehost", -1); Assert.assertEquals("http: final HttpHost host3 = new HttpHost("somehost", -1); Assert.assertEquals("http: final HttpHost host4 = new HttpHost("somehost", 8888); Assert.assertEquals("http: final HttpHost host5 = new HttpHost("myhttp", "somehost", -1); Assert.assertEquals("myhttp: final HttpHost host6 = new HttpHost("myhttp", "somehost", 80); Assert.assertEquals("myhttp: final HttpHost host7 = new HttpHost( "http", InetAddress.getByAddress("127.0.0.1", new byte[] {127,0,0,1}), 80); Assert.assertEquals("http: final HttpHost host9 = new HttpHost( "http", InetAddress.getByAddress("somehost", new byte[] {127,0,0,1}), 80); Assert.assertEquals("http: }