List of usage examples for org.apache.http.nio.conn.scheme AsyncScheme getDefaultPort
public final int getDefaultPort()
From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java
private HttpRequest createConnectRequest(final HttpRoute route) { // see RFC 2817, section 5.2 and // INTERNET-DRAFT: Tunneling TCP based protocols through // Web proxy servers final HttpHost target = route.getTargetHost(); final String host = target.getHostName(); int port = target.getPort(); if (port < 0) { final AsyncSchemeRegistry registry = getSchemeRegistry(this.localContext); final AsyncScheme scheme = registry.getScheme(target.getSchemeName()); port = scheme.getDefaultPort(); }/*w ww.ja va 2 s. c o m*/ final StringBuilder buffer = new StringBuilder(host.length() + 6); buffer.append(host); buffer.append(':'); buffer.append(Integer.toString(port)); final ProtocolVersion ver = HttpProtocolParams.getVersion(this.params); final HttpRequest req = new BasicHttpRequest("CONNECT", buffer.toString(), ver); return req; }