@@ -640,8 +640,14 @@ public boolean isSSL(){
640
640
}
641
641
642
642
/**
643
- * Convenience method for setting up a SSL socket factory/engine, using
644
- * the DEFAULT_SSL_PROTOCOL and a trusting TrustManager.
643
+ * Convenience method for configuring TLS using
644
+ * the default set of TLS protocols and a trusting TrustManager.
645
+ * This setup is <strong>only suitable for development
646
+ * and QA environments</strong>.
647
+ * The trust manager will <strong>trust every server certificate presented</strong>
648
+ * to it, this is convenient for local development but
649
+ * <strong>not recommended to use in production</strong> as it provides no protection
650
+ * against man-in-the-middle attacks. Prefer {@link #useSslProtocol(SSLContext)}.
645
651
*/
646
652
public void useSslProtocol ()
647
653
throws NoSuchAlgorithmException , KeyManagementException
@@ -650,8 +656,17 @@ public void useSslProtocol()
650
656
}
651
657
652
658
/**
653
- * Convenience method for setting up a SSL socket factory/engine, using
654
- * the supplied protocol and a very trusting TrustManager.
659
+ * Convenience method for configuring TLS using
660
+ * the supplied protocol and a very trusting TrustManager. This setup is <strong>only suitable for development
661
+ * and QA environments</strong>.
662
+ * The trust manager <strong>will trust every server certificate presented</strong>
663
+ * to it, this is convenient for local development but
664
+ * not recommended to use in production as it <strong>provides no protection
665
+ * against man-in-the-middle attacks</strong>.
666
+ *
667
+ * Use {@link #useSslProtocol(SSLContext)} in production environments.
668
+ * The produced {@link SSLContext} instance will be shared by all
669
+ * the connections created by this connection factory.
655
670
*/
656
671
public void useSslProtocol (String protocol )
657
672
throws NoSuchAlgorithmException , KeyManagementException
@@ -660,10 +675,16 @@ public void useSslProtocol(String protocol)
660
675
}
661
676
662
677
/**
663
- * Convenience method for setting up an SSL socket factory/engine.
664
- * Pass in the SSL protocol to use, e.g. "TLSv1" or "TLSv1.2".
678
+ * Convenience method for configuring TLS.
679
+ * Pass in the TLS protocol version to use, e.g. "TLSv1.2" or "TLSv1.1", and
680
+ * a desired {@link TrustManager}.
681
+ *
665
682
*
666
- * @param protocol SSL protocol to use.
683
+ * The produced {@link SSLContext} instance will be shared with all
684
+ * the connections created by this connection factory.
685
+ * @param protocol the TLS protocol to use.
686
+ * @param trustManager the {@link TrustManager} implementation to use.
687
+ * @see #useSslProtocol(SSLContext)
667
688
*/
668
689
public void useSslProtocol (String protocol , TrustManager trustManager )
669
690
throws NoSuchAlgorithmException , KeyManagementException
@@ -674,9 +695,12 @@ public void useSslProtocol(String protocol, TrustManager trustManager)
674
695
}
675
696
676
697
/**
677
- * Convenience method for setting up an SSL socket factory/engine.
678
- * Pass in an initialized SSLContext.
698
+ * Sets up TLS with an initialized {@link SSLContext}. The caller is responsible
699
+ * for setting up the context with a {@link TrustManager} with suitable security guarantees,
700
+ * e.g. peer verification.
679
701
*
702
+ * The {@link SSLContext} instance will be shared with all
703
+ * the connections created by this connection factory.
680
704
* @param context An initialized SSLContext
681
705
*/
682
706
public void useSslProtocol (SSLContext context ) {
0 commit comments