title: How to enable TLS 1.2 in Java 7
body: <p>I am trying to enable TLS 1.2 in my web app which uses JBoss 6.4 and Java 1.7. I have <code>-Dhttp.protocols = TLSv1.2</code> in my application environment but it doesn't seem to work for me. </p>
  
  <p>Is there anything I could do to enable TLS 1.2?</p>
  
  <p>I wrote a simple program </p>
  
  <pre><code>context = SSLContext.getInstance("TLSv1.2");
  context.init(null,null,null);
  SSLContext.setDefault(context); 
  SSLSocketFactory factory = (SSLSocketFactory)context.getSocketFactory();
  SSLSocket socket = (SSLSocket)factory.createSocket();
  protocols = socket.getEnabledProtocols();
  </code></pre>
  
  <p>After running this program within the app the TLS 1.2 gets enabled. I do not want to run this program but I want to directly enable it during app startup. Is there any way to do it?</p>