How to do HTTP CONNECT Method by HTTPClient behind Proxy
<p>I am programing a Browser using <code>HTTPClient</code> to access HTTPS on Android.
The following source code has implemented access HTTPS by <code>HTTPClient</code>.</p>

<pre><code>  // Proxy Host and Port
  String proxyHost = "127.0.0.1";
  int proxyPort = 10000;
  // HTTPS Site
  String strURL_https = "https://172.17.4.37:8443/apache.html"; 
  URL url_https = null;
  HttpClient httpClient = null;
  HttpGet get = null;
  try{
    url_https = new URL(strURL_https);
    MySSLSocketFactory sf = MySSLSocketFactory.getSocketFactory();              
    get = new HttpGet(strURL_https);
    try {

      HttpParams params = new BasicHttpParams();
      HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
      HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);

      // Add two scheme for Port 443 and 8443        
      httpClient = new DefaultHttpClient();
      Scheme sch = new Scheme("https", sf, 443);
      Scheme sch2 = new Scheme("https", sf, 8443);
      httpClient.getConnectionManager().getSchemeRegistry().register(sch);
      httpClient.getConnectionManager().getSchemeRegistry().register(sch2);
      // Set Proxy   
      httpClient.getParams().setParameter(ConnRouteParams.DEFAULT_PROXY, new HttpHost(proxyHost, proxyPort));

   } catch (Exception e) {
     e.printStackTrace();           
   }
   HttpContext context = new BasicHttpContext();
   // Execute GET Method
   HttpResponse response = httpClient.execute(get, context);
   HttpEntity entity = response.getEntity();
   String charSet = null;
   String contentType = null;
   StringBuffer sb = null;
   if(entity!= null){
     charSet=EntityUtils.getContentCharSet(entity);
     contentType=entity.getContentType().getValue();
     InputStream is = entity.getContent();
     BufferedReader br = new BufferedReader(new InputStreamReader(is, "utf8"));
     String text = null;
     String line = br.readLine();
     sb = new StringBuffer();
     while(line != null) {
       sb.append(line+"\r\n");
       line = br.readLine();
     }
   }
   // Load Data on Webview
   webview.loadDataWithBaseURL(strURL_https, sb.toString(), "text/html", charSet, null);
</code></pre>

<p>But when do <code>httpClient.execute(get, context)</code>, my proxy server will receive HTTP CONNECT Method as the following:</p>

<pre><code>CONNECT 172.17.4.37:8443 HTTP/1.1
User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4)
Host: 172.17.4.37:8443
</code></pre>

<p>My proxy server send the HTTP Method to VPN, but cannot get any response.
In my opinion, I should get like <code>HTTP/1.0 200 Connection Established</code>.</p>

<p>My question is how to do <code>HTTP CONNECT</code> Method by <code>HTTPClient</code> without proxy.
After create connection established, set proxy to <code>HTTPClient</code>.</p>

<p>I am looking forward your answer. </p>

<p>Thank you.</p>
