@Test public void testCreateFromURI() throws Exception { Assert.assertEquals(new HttpHost("https", "somehost", 8080), HttpHost.create(URI.create("https: Assert.assertEquals(new HttpHost("https", "somehost", 8080), HttpHost.create(URI.create("HttpS: Assert.assertEquals(new HttpHost("https", "somehost", 8080), HttpHost.create(URI.create("HttpS: }
public static HttpHost create(final String s) throws URISyntaxException { Args.notEmpty(s, "HTTP Host"); String text = s; String scheme = null; final int schemeIdx = text.indexOf(": if (schemeIdx > 0) { scheme = text.substring(0, schemeIdx); if (TextUtils.containsBlanks(scheme)) { throw new URISyntaxException(s, "scheme contains blanks"); } text = text.substring(schemeIdx + 3); } int port = -1; final int portIdx = text.lastIndexOf(":"); if (portIdx > 0) { try { port = Integer.parseInt(text.substring(portIdx + 1)); } catch (final NumberFormatException ex) { throw new URISyntaxException(s, "invalid port"); } text = text.substring(0, portIdx); } if (TextUtils.containsBlanks(text)) { throw new URISyntaxException(s, "hostname contains blanks"); } return new HttpHost(scheme, null, text, port); }
HttpHost implements NamedEndpoint, Serializable { public static HttpHost create(final String s) throws URISyntaxException { Args.notEmpty(s, "HTTP Host"); String text = s; String scheme = null; final int schemeIdx = text.indexOf(": if (schemeIdx > 0) { scheme = text.substring(0, schemeIdx); if (TextUtils.containsBlanks(scheme)) { throw new URISyntaxException(s, "scheme contains blanks"); } text = text.substring(schemeIdx + 3); } int port = -1; final int portIdx = text.lastIndexOf(":"); if (portIdx > 0) { try { port = Integer.parseInt(text.substring(portIdx + 1)); } catch (final NumberFormatException ex) { throw new URISyntaxException(s, "invalid port"); } text = text.substring(0, portIdx); } if (TextUtils.containsBlanks(text)) { throw new URISyntaxException(s, "hostname contains blanks"); } return new HttpHost(scheme, null, text, port); } }
HttpHost implements NamedEndpoint, Serializable { public static HttpHost create(final String s) throws URISyntaxException { Args.notEmpty(s, "HTTP Host"); String text = s; String scheme = null; final int schemeIdx = text.indexOf(": if (schemeIdx > 0) { scheme = text.substring(0, schemeIdx); if (TextUtils.containsBlanks(scheme)) { throw new URISyntaxException(s, "scheme contains blanks"); } text = text.substring(schemeIdx + 3); } int port = -1; final int portIdx = text.lastIndexOf(":"); if (portIdx > 0) { try { port = Integer.parseInt(text.substring(portIdx + 1)); } catch (final NumberFormatException ex) { throw new URISyntaxException(s, "invalid port"); } text = text.substring(0, portIdx); } if (TextUtils.containsBlanks(text)) { throw new URISyntaxException(s, "hostname contains blanks"); } return new HttpHost(scheme, null, text, port); } 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); }
HttpHost implements NamedEndpoint, Serializable { public static HttpHost create(final String s) throws URISyntaxException { Args.notEmpty(s, "HTTP Host"); String text = s; String scheme = null; final int schemeIdx = text.indexOf(": if (schemeIdx > 0) { scheme = text.substring(0, schemeIdx); if (TextUtils.containsBlanks(scheme)) { throw new URISyntaxException(s, "scheme contains blanks"); } text = text.substring(schemeIdx + 3); } int port = -1; final int portIdx = text.lastIndexOf(":"); if (portIdx > 0) { try { port = Integer.parseInt(text.substring(portIdx + 1)); } catch (final NumberFormatException ex) { throw new URISyntaxException(s, "invalid port"); } text = text.substring(0, portIdx); } if (TextUtils.containsBlanks(text)) { throw new URISyntaxException(s, "hostname contains blanks"); } return new HttpHost(scheme, null, text, port); } 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(); }
HttpHost implements NamedEndpoint, Serializable { public static HttpHost create(final String s) throws URISyntaxException { Args.notEmpty(s, "HTTP Host"); String text = s; String scheme = null; final int schemeIdx = text.indexOf(": if (schemeIdx > 0) { scheme = text.substring(0, schemeIdx); if (TextUtils.containsBlanks(scheme)) { throw new URISyntaxException(s, "scheme contains blanks"); } text = text.substring(schemeIdx + 3); } int port = -1; final int portIdx = text.lastIndexOf(":"); if (portIdx > 0) { try { port = Integer.parseInt(text.substring(portIdx + 1)); } catch (final NumberFormatException ex) { throw new URISyntaxException(s, "invalid port"); } text = text.substring(0, portIdx); } if (TextUtils.containsBlanks(text)) { throw new URISyntaxException(s, "hostname contains blanks"); } return new HttpHost(scheme, null, text, port); } 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; }