title: HTTP/HTTPS client, "connection reset" on HTTPS requests
body: <p>I'm trying to make a simple <strong>HTTP/HTTPS client using java</strong>. What i have done as of now in my Client.java file is here.</p>
  
  <p>Everything is working good when i try to access www.google.com:80.  I'm getting the full HTML content in my response BufferedReader.</p>
  
  <p>But, when i try to access www.google.com:443, there is no data coming through BufferedReader</p>
  
  <p>For www.facebook.com:80,</p>
  
  <pre><code>HTTP/1.1 302 Found
  </code></pre>
  
  <p>Also, when i try with www.facebook.com:443, Getting the following error:</p>
  
  <pre><code>Exception in thread "main" java.net.SocketException: Connection reset
  </code></pre>
  
  <p>Where am i going wrong? Why am i not able to get any response for the HTTPS sites?</p>
  
  <pre><code>public class Client {
  
      public static void main(String[] args) throws IOException {
  
          //String host = args[0];
          //int port = Integer.parseInt(args[1]);
          //String path = args[2];
  
          int port = 80;
          String host = "www.google.com";
          String path = "/";
  
          //Opening Connection
          Socket clientSocket = new Socket(host, port);
          System.out.println("======================================");
          System.out.println("Connected");
          System.out.println("======================================");
  
          //Declare a writer to this url
          PrintWriter request = new PrintWriter(clientSocket.getOutputStream(),true);
  
          //Declare a listener to this url
          BufferedReader response = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  
          //Sending request to the server
          //Building HTTP request header
          request.print("GET "+path+" HTTP/1.1\r\n"); //"+path+"
          request.print("Host: "+host+"\r\n");
          request.print("Connection: close\r\n");
          request.print("\r\n");
          request.flush();
  
          System.out.println("Request Sent!");
          System.out.println("======================================");
  
          //Receiving response from server
          String responseLine;
          while ((responseLine = response.readLine()) != null) {
              System.out.println(responseLine);
          }
          System.out.println("======================================"); 
          System.out.println("Response Recieved!!");
          System.out.println("======================================");
          request.close();
          response.close();
          clientSocket.close();
      }
  }
  </code></pre>