shadows/httpclient/src/main/java/org/robolectric/shadows/httpclient/DefaultRequestDirector.java
protected HttpRequest createConnectRequest(HttpRoute route,
                         HttpContext context) {
    // see RFC 2817, section 5.2 and
    // INTERNET-DRAFT: Tunneling TCP based protocols through
    // Web proxy servers

    HttpHost target = route.getTargetHost();

    String host = target.getHostName();
    int port = target.getPort();
    if (port < 0) {
      Scheme scheme = connManager.getSchemeRegistry().
        getScheme(target.getSchemeName());
      port = scheme.getDefaultPort();
    }

    StringBuilder buffer = new StringBuilder(host.length() + 6);
    buffer.append(host);
    buffer.append(':');
    buffer.append(Integer.toString(port));

    String authority = buffer.toString();
    ProtocolVersion ver = HttpProtocolParams.getVersion(params);
    HttpRequest req = new BasicHttpRequest
      ("CONNECT", authority, ver);

    return req;
  }
protected HttpRequest createConnectRequest(HttpRoute route,
                         HttpContext context) {
    // see RFC 2817, section 5.2 and
    // INTERNET-DRAFT: Tunneling TCP based protocols through
    // Web proxy servers

    HttpHost target = route.getTargetHost();

    String host = target.getHostName();
    int port = target.getPort();
    if (port < 0) {
      Scheme scheme = connManager.getSchemeRegistry().
        getScheme(target.getSchemeName());
      port = scheme.getDefaultPort();
    }

    StringBuilder buffer = new StringBuilder(host.length() + 6);
    buffer.append(host);
    buffer.append(':');
    buffer.append(Integer.toString(port));

    String authority = buffer.toString();
    ProtocolVersion ver = HttpProtocolParams.getVersion(params);
    HttpRequest req = new BasicHttpRequest
      ("CONNECT", authority, ver);

    return req;
  }
Creates the CONNECT request for tunnelling.
Called by {@link #createTunnelToTarget createTunnelToTarget}.

@param route     the route to establish
@param context   the context for request execution

@return  the CONNECT request for tunnelling