title: Having issue changing TLSv1 to TLSv1.2 using SSLContext
body: <p>I am trying to enable <strong>TLSv1.2</strong> using <strong>SSLContext</strong> and i tried <strong>System.setProperty("https.protocols", "TLSv1.2")</strong>. I am want to enable it for salesforce soap API in my application. The issue is when i run my sample code the TLS version is <strong>TLSv1</strong> so i use my code and change it to <strong>TLSv1.2</strong>. My sample code.</p>
  
  <pre><code> public static void tls(String tls){
      SSLContext context;
  
        try {
          System.out.println(SSLContext.getDefault().getProtocol());
          context = SSLContext.getInstance(tls);
          context.init(null, null, null);
          System.out.println(SSLContext.getDefault().getProtocol());
          System.setProperty("https.protocols", tls);
          SSLContext.setDefault(context);
          System.out.println(SSLContext.getDefault().getProtocol());
        } catch (NoSuchAlgorithmException e) {
              e.printStackTrace();
        }
  }`
  </code></pre>
  
  <p>After changing TLSv1 to TLSv1.2 when i hit salesforce Soap API its uses TLSv1 which salesforce rejects as i have disable TLSv1 on my salesforce account. My salesfoce connection code </p>
  
  <pre><code>public static void login(){
      try {
  
           System.out.println("login()"+SSLContext.getDefault().getProtocol());
           String username = "userName";
           String password = "pass";
           String authEndPoint = "https://login.salesforce.com/services/Soap/u/8.0/";
           SoapBindingStub binding = null;
           binding = (SoapBindingStub)new SforceServiceLocator().getSoap();
           binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, authEndPoint);
           LoginResult rs = null;
           rs = binding.login(username, password);
           GetUserInfoResult userInfo =rs.getUserInfo();
           binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, rs.getServerUrl());
           } catch (RemoteException e) {
              System.out.println(e.getMessage());
           } catch (Exception e) {
              e.printStackTrace();
           }
  }
  </code></pre>
  
  <p>My Salesforce account login activity logs. </p>
  
  <blockquote>
    <p>Failed: Login over insecure channel-SOAP-Partner-8.0-login.salesforce.com-TLS 1.0</p>
  </blockquote>
  
  <p>I tried every thing i find on google but the issue remain the same. Help me out with this.</p>