title: how to use TLSV1 or SSLV3 for first handshake(Client Hello) in Java?
body: <p>When I execute the following code, why is the first handshake SSLv2, not TLSv1 or SSLv3? </p>
  
  <p>How to use TLSV1 or SSLV3 for first handshake in Java? </p>
  
  <pre><code>String host = "www.google.com";
  String url = "/adsense/?sourceid=aso&amp;subid=ZH_CN-ET-AS-ADSBY6&amp;medium=link&amp;hl=zh_CN";
  SSLContext ctx = SSLContext.getInstance("TLS");
  ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()}, new SecureRandom());
  SSLContext.setDefault(ctx);
  SSLSocketFactory factory = ctx.getSocketFactory();
  Socket socket = factory.createSocket(host, 443);
  BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
  BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  out.write("GET " + url + " HTTP/1.0");
  out.flush();
  out.close();
  in.close();
  </code></pre>