@@ -653,12 +653,14 @@ public boolean isSSL(){
653
653
}
654
654
655
655
/**
656
- * Convenience method for setting up a SSL socket factory/engine, using
657
- * the DEFAULT_SSL_PROTOCOL and a trusting TrustManager.
658
- * Note the trust manager will trust every server certificate presented
656
+ * Convenience method for configuring TLS using
657
+ * the default set of TLS protocols and a trusting TrustManager.
658
+ * This setup is <strong>only suitable for development
659
+ * and QA environments</strong>.
660
+ * The trust manager will <strong>trust every server certificate presented</strong>
659
661
* to it, this is convenient for local development but
660
- * not recommended to use in production as it provides no protection
661
- * against man-in-the-middle attacks.
662
+ * <strong> not recommended to use in production</strong> as it provides no protection
663
+ * against man-in-the-middle attacks. Prefer {@link #useSslProtocol(SSLContext)}.
662
664
*/
663
665
public void useSslProtocol ()
664
666
throws NoSuchAlgorithmException , KeyManagementException
@@ -667,15 +669,19 @@ public void useSslProtocol()
667
669
}
668
670
669
671
/**
670
- * Convenience method for setting up a SSL socket factory/engine, using
671
- * the supplied protocol and a very trusting TrustManager.
672
- * Note the trust manager will trust every server certificate presented
672
+ * Convenience method for configuring TLS using
673
+ * the supplied protocol and a very trusting TrustManager. This setup is <strong>only suitable for development
674
+ * and QA environments</strong>.
675
+ * The trust manager <strong>will trust every server certificate presented</strong>
673
676
* to it, this is convenient for local development but
674
- * not recommended to use in production as it provides no protection
675
- * against man-in-the-middle attacks.
677
+ * not recommended to use in production as it <strong>provides no protection
678
+ * against man-in-the-middle attacks</strong>.
679
+ *
680
+ * Use {@link #useSslProtocol(SSLContext)} in production environments.
676
681
* The produced {@link SSLContext} instance will be shared by all
677
- * the connections created by this connection factory. Use
678
- * {@link #setSslContextFactory(SslContextFactory)} for more flexibility.
682
+ * the connections created by this connection factory.
683
+ *
684
+ * Use {@link #setSslContextFactory(SslContextFactory)} for more flexibility.
679
685
* @see #setSslContextFactory(SslContextFactory)
680
686
*/
681
687
public void useSslProtocol (String protocol )
@@ -685,13 +691,18 @@ public void useSslProtocol(String protocol)
685
691
}
686
692
687
693
/**
688
- * Convenience method for setting up an SSL socket factory/engine.
689
- * Pass in the SSL protocol to use, e.g. "TLSv1" or "TLSv1.2".
694
+ * Convenience method for configuring TLS.
695
+ * Pass in the TLS protocol version to use, e.g. "TLSv1.2" or "TLSv1.1", and
696
+ * a desired {@link TrustManager}.
697
+ *
698
+ *
690
699
* The produced {@link SSLContext} instance will be shared with all
691
700
* the connections created by this connection factory. Use
692
701
* {@link #setSslContextFactory(SslContextFactory)} for more flexibility.
693
- * @param protocol SSL protocol to use.
702
+ * @param protocol the TLS protocol to use.
703
+ * @param trustManager the {@link TrustManager} implementation to use.
694
704
* @see #setSslContextFactory(SslContextFactory)
705
+ * @see #useSslProtocol(SSLContext)
695
706
*/
696
707
public void useSslProtocol (String protocol , TrustManager trustManager )
697
708
throws NoSuchAlgorithmException , KeyManagementException
@@ -702,8 +713,11 @@ public void useSslProtocol(String protocol, TrustManager trustManager)
702
713
}
703
714
704
715
/**
705
- * Convenience method for setting up an SSL socket socketFactory/engine.
706
- * Pass in an initialized SSLContext.
716
+ * Sets up TLS with an initialized {@link SSLContext}. The caller is responsible
717
+ * for setting up the context with a {@link TrustManager} with suitable security guarantees,
718
+ * e.g. peer verification.
719
+ *
720
+ *
707
721
* The {@link SSLContext} instance will be shared with all
708
722
* the connections created by this connection factory. Use
709
723
* {@link #setSslContextFactory(SslContextFactory)} for more flexibility.
0 commit comments