@Test
public void testToString() throws Exception {

    final HttpHost host1 = new HttpHost("somehost");
    Assert.assertEquals("http://somehost", host1.toString());
    final HttpHost host2 = new HttpHost("somehost", -1);
    Assert.assertEquals("http://somehost", host2.toString());
    final HttpHost host3 = new HttpHost("somehost", -1);
    Assert.assertEquals("http://somehost", host3.toString());
    final HttpHost host4 = new HttpHost("somehost", 8888);
    Assert.assertEquals("http://somehost:8888", host4.toString());
    final HttpHost host5 = new HttpHost("myhttp", "somehost", -1);
    Assert.assertEquals("myhttp://somehost", host5.toString());
    final HttpHost host6 = new HttpHost("myhttp", "somehost", 80);
    Assert.assertEquals("myhttp://somehost:80", host6.toString());
    final HttpHost host7 = new HttpHost(
            "http", InetAddress.getByAddress("127.0.0.1", new byte[] {127,0,0,1}), 80);
    Assert.assertEquals("http://127.0.0.1:80", host7.toString());
    final HttpHost host9 = new HttpHost(
                    "http", InetAddress.getByAddress("somehost", new byte[] {127,0,0,1}), 80);
    Assert.assertEquals("http://somehost:80", host9.toString());
}