code: public static void initTLSv11orUpper() throws NoSuchAlgorithmException, KeyManagementException, IOException {
          final SSLSocket socket = (SSLSocket) SSLContext.getDefault().getSocketFactory().createSocket();
          if (isTLSv11orUpperEnabled(socket)) {
              return;
          }
          final String[] supportedProtocols = socket.getSupportedProtocols();
          Arrays.sort(supportedProtocols);
          for (int i = supportedProtocols.length - 1; i >= 0; i--) {
              final String supportedProtocol = supportedProtocols[i];
              if (supportedProtocol.startsWith("TLSv1.")) {
                  final SSLContext context = SSLContext.getInstance(supportedProtocol);
                  context.init(null, null, null);
                  SSLContext.setDefault(context);
                  return;
              }
          }
  
          throw new NoSuchAlgorithmException("for Salesforce API to work you need jvm with TLS 1.1 or higher support");
      }
docs: Salesforce API requires to use TLSv1.1 or upper.
  <p>
  Java 8 have TLS 1.2 enabled by default. java 7 - no, you should invoke this method or turn TLS&gt;=1.1 somehow
  else</p>
  
  @throws java.security.NoSuchAlgorithmException in case your jvm doesn't support TLSv1.1 or higher
  @throws java.security.KeyManagementException unexpected Exception from
  {@link SSLContext#init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom)}
  @throws java.io.IOException unexpected Exception from {@link javax.net.ssl.SSLSocketFactory#createSocket()}