@@ -640,8 +640,14 @@ public boolean isSSL(){
640640 }
641641
642642 /**
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)}.
645651 */
646652 public void useSslProtocol ()
647653 throws NoSuchAlgorithmException , KeyManagementException
@@ -650,8 +656,17 @@ public void useSslProtocol()
650656 }
651657
652658 /**
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.
655670 */
656671 public void useSslProtocol (String protocol )
657672 throws NoSuchAlgorithmException , KeyManagementException
@@ -660,10 +675,16 @@ public void useSslProtocol(String protocol)
660675 }
661676
662677 /**
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+ *
665682 *
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)
667688 */
668689 public void useSslProtocol (String protocol , TrustManager trustManager )
669690 throws NoSuchAlgorithmException , KeyManagementException
@@ -674,9 +695,12 @@ public void useSslProtocol(String protocol, TrustManager trustManager)
674695 }
675696
676697 /**
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.
679701 *
702+ * The {@link SSLContext} instance will be shared with all
703+ * the connections created by this connection factory.
680704 * @param context An initialized SSLContext
681705 */
682706 public void useSslProtocol (SSLContext context ) {
0 commit comments