### Question:
URIUtils { public static HttpHost extractHost(final URI uri) { if (uri == null) { return null; } final URIBuilder uriBuilder = new URIBuilder(uri); final String scheme = uriBuilder.getScheme(); final String host = uriBuilder.getHost(); final int port = uriBuilder.getPort(); if (!TextUtils.isBlank(host)) { try { return new HttpHost(scheme, host, port); } catch (final IllegalArgumentException ignore) { } } return null; } private  URIUtils(); static URI rewriteURI(
            final URI uri,
            final HttpHost target,
            final boolean dropFragment); static URI rewriteURI(
            final URI uri,
            final HttpHost target); static URI rewriteURI(final URI uri); static URI resolve(final URI baseURI, final String reference); static URI resolve(final URI baseURI, final URI reference); static HttpHost extractHost(final URI uri); static URI resolve(
            final URI originalURI,
            final HttpHost target,
            final List<URI> redirects); static URI create(final HttpHost host, final String path); static URI create(final String scheme, final URIAuthority host, final String path);  }### Answer:
@Test public void testExtractHost() throws Exception { Assert.assertEquals(new HttpHost("localhost"), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("localhost"), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("local_host"), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("local_host"), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("localhost",8), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("local_host",8), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("localhost",-1),URIUtils.extractHost( new URI("http: Assert.assertEquals(new HttpHost("local_host",-1),URIUtils.extractHost( new URI("http: Assert.assertEquals(new HttpHost("localhost",8080), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("local_host",8080), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("localhost",8080),URIUtils.extractHost( new URI("http: Assert.assertEquals(new HttpHost("local_host",8080),URIUtils.extractHost( new URI("http: Assert.assertEquals(new HttpHost("[2a00:1450:400c:c01::69]",8080), URIUtils.extractHost(new URI("http: Assert.assertEquals(new HttpHost("localhost",8080), URIUtils.extractHost(new URI("http: Assert.assertEquals(null, URIUtils.extractHost(new URI("http: Assert.assertEquals(null, URIUtils.extractHost(new URI("http: Assert.assertEquals(null, URIUtils.extractHost(new URI("http: Assert.assertEquals(null, URIUtils.extractHost(new URI("http: }