title: How to send an HTTPS request by socket?
body: <p>I am learning about Java socket. I am trying to send an HTTPS GET request to Facebook, like this:</p>
  
  <pre><code>String request = "GET / HTTP/1.0\r\n"
                  + "Host: www.facebook.com\r\n"
                  + "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0\r\n"
                  + "Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7\r\n"
                  + "Accept-Language: de,en;q=0.7,en-us;q=0.3\r\n"
                  + "Accept-Encoding: gzip\r\n"
                  + "Connection: close\r\n\r\n";
  byte[] Outdata = request.getBytes();
  Socket server = new Socket("www.facebook.com", 443);
  DataOutputStream outputStream = new DataOutputStream(server.getOutputStream());
  outputStream.write(Outdata);
  outputStream.flush();
  </code></pre>
  
  <p>And then, I try to listen to incoming data from the server, like this:</p>
  
  <pre><code> DataInputStream inputStream =
       new DataInputStream(server.getInputStream());    
   byte[] InData = new byte[1024];
  
   while (true) {
       inputStream.read(InData);
       String data = new String(InData, StandardCharsets.UTF_8);
       System.out.println(data);
   }
  </code></pre>
  
  <p>But I don't get any return data from the server. Why?</p>