title: How to prevent CONNECT method call from HttpsURLConnection
body: <p>I have an Android client making HTTPS request to a server.  The firewall logs have entries for CONNECT request methods which are not desired.</p>
  
  <p>When would the CONNECT request get sent out and how can I prevent it from being sent?  I expect only a GET request.  My understanding is that the call to openConnection() does not actually make a request and that the GET request would go on the call to getResponseMessage().</p>
  
  <p>How can I disable the http client from attempting to establish a proxy tunnel?</p>
  
  <p>Here is how I sent up my connection and make the call:</p>
  
  <pre><code>URL url = new URL("https://some.server.com");
  HttpURLConnection connection = (HttpURLConnection)url.openConnection();
  connection.setConnectTimeout(CONNECT_TIMEOUT);
  connection.setReadTimeout(REAT_TIMEOUT);
  connection.setRequestProperty(ACCEPT_CHARSET, UTF8_CHARSET);
  connection.setRequestProperty(CONTENT_TYPE_HEADER, contentType);
  setCustomRequestProperties(connection);
  connection.setRequestMethod("GET");
  
  //create response
  connection.getResponseMessage();
  connection.getResponseCode();
  connection.getContentType();
  connection.getContent();
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Here is the Firewall Log entry that I am trying to prevent:</p>
  
  <pre><code>CONNECT someURL.domain.com:443 HTTP/1.1
  Host: someURL.domain.com
  User-Agent: CustomUserAgent;1.0.0(Android 4.3;Nexus 4;T-Mobile)
  Proxy-Connection: Keep-Alive
  X-SSL-Secure: true
  X-CS-Source-IP: 10.3.3.3
  X-Forwarded-For: 10.3.3.3
  </code></pre>
  
  <p>I thought this was proxy related because of the "Proxy-Connection" header</p>