title: Send HTTPS Request using SSL Socket
body: <p>Hi:  I am trying to make a small  HTTPS client program mainly usign JAVA.</p>
  
  <p>Below is the code snippet:</p>
  
  <pre><code>SSLSocket result = (SSLSocket) SSLCont.sslSocketFactory.createSocket(
                      sockfd, "www.facebook.com", 443, false);
  result.startHandshake(); 
  result.getOutputStream().write("GET / HTTP/1.1\r\nHost: www.facebook.com\r\n\r\n".getBytes());
  String  res=my.getData(result.getInputStream());
  print(res);
  </code></pre>
  
  <p>I can print Facebook response properly. There is no issue.</p>
  
  <p>The issue is - when I see the traffic using "TRAFFIC capture" program I see following data  for "TLS:TLS Rec Layer-1 HandShake: Client Hello." part</p>
  
  <pre><code>TLS:TLS Rec Layer-1 HandShake: Client Hello.
  . .....ÿÿÿÿ.............ïM©.LoÓ....??ÞÐJd:Ôn..¡.?ÞÐJd:..ªª.....
  .E..ë.×@.@.».À¨.eð.$?6.»§.Îç?ç.?P.ý\?-
  ......¾...º..???v????{3?¯ß.DÅJ.&gt;?÷®ÿ±û*^».8i1...À+À/Ì©Ì¨À,À0À.À.À
  .À..3.9./.5.....s.........www.facebook.com....ÿ.
  ........................#...............................
  ..........................
  </code></pre>
  
  <p>But when I  open  the website ( www.facebook.com ) directly in Browser say in CHROME,  I see following traffic :</p>
  
  <pre><code>TLS:TLS Rec Layer-1 HandShake: Client Hello.
  . .....ÿÿÿÿ.............ïM©.LoÓ....??ÞÐJd:Ôn..¡.?ÞÐJd:..ªª.....
  .E..ë.×@.@.».À¨.eð.$?6.»§.Îç?ç.?P.ý\?-
  ......¾...º..???v????{3?¯ß.DÅJ.&gt;?÷®ÿ±û*^».8i1...À+À/Ì©Ì¨À,À0À.À.À
  .À..3.9./.5.....s.........www.facebook.com....ÿ.
  ........................#.........h2.http/1.1...........
  ..........................
  </code></pre>
  
  <p>If we  compare both traffic data carefully we see ,   in case of Traffic Generated by Chrome browser we  will see  following extra string
  <strong>"..h2.http/1.1...."</strong> appended at last ,which tells it is for HTTP and looks perfect.</p>
  
  <p>But this string is not getting appended  in traffic generated  by  my java program.</p>
  
  <p>Can you please tell me  why  "<em>..h2.http/1.1....</em>"  string not appearing in traffic generated by my java program. 
  How to modify my java code so that the string appears in the request traffic generated by my java program .</p>
  
  <p>Note:  But when I use java inbuilt class "<strong>HttpsURLConnection</strong>"  to open that website  I see "<em>..h2.http/1.1....</em>"  is present in traffic. 
  This issue is applicable for all HTTPS websites. </p>
  
  <p>Can you please tell me What is missing in my Java code.</p>
  
  <p>Thank you in advance</p>