title: How to execute a https GET request from java
body: <p>I wrote a Java client which executes <code>http</code> GET requests without any problem. 
  Now I want to modify this client in order to execute <code>https</code> GET requests.</p>
  
  <pre><code>import org.apache.http.HttpHost;
  import org.apache.http.auth.AuthScope;
  import org.apache.http.auth.UsernamePasswordCredentials;
  import org.apache.http.client.CredentialsProvider;
  import org.apache.http.client.config.RequestConfig;
  import org.apache.http.client.methods.CloseableHttpResponse;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.impl.client.BasicCredentialsProvider;
  import org.apache.http.impl.client.CloseableHttpClient;
  import org.apache.http.impl.client.HttpClients;
  
  private String executeGet(final String url, String proxy, int port)
          throws IOException, RequestUnsuccesfulException, InvalidParameterException {
  
      CloseableHttpClient httpclient = null;
      String ret = "";
      RequestConfig config;
  
      try {                       
          String hostname = extractHostname(url);
          logger.info("Hostname {}", hostname);
  
          HttpHost target = new HttpHost(hostname, 80, null);
  
          HttpHost myProxy = new HttpHost(proxy, port, "http");
          CredentialsProvider credsProvider = new BasicCredentialsProvider();
          credsProvider.setCredentials(
                  AuthScope.ANY,
                  new UsernamePasswordCredentials(USERNAME, PASSWORD));
  
          httpclient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();         
          config = RequestConfig.custom().setProxy(myProxy).build();
  
  
          HttpGet request = new HttpGet(url);
          request.setConfig(config);
          CloseableHttpResponse response = httpclient.execute(target, request);
  
          ...
  </code></pre>
  
  <p>I was expecting an easy modification like using <code>HttpsGet</code> instead of <code>HttpGet</code> but no, there is no <code>HttpsGet</code> class available.</p>
  
  <p>What is the easiest way to modify this method in order to handle <code>https</code> GET requests?</p>