added some extra constructors, JavaDoc
protected SSLSocketFactoryCreatorBuilder sslSocketFactoryCreatorBuilder;
protected boolean filterCipherSuites = true;
+ /**
+ * Create a builder for a client using a custom SSLSocketFactoryCreator.
+ *
+ * @param hostName hostName to talk to.
+ * @param socketFactoryCreator a custom creator of socket factories.
+ */
+ public JsseESTServiceBuilder(String hostName, int portNo, SSLSocketFactoryCreator socketFactoryCreator)
+ {
+ super(hostName + ":" + portNo);
+ if (socketFactoryCreator == null)
+ {
+ throw new NullPointerException("No socket factory creator.");
+ }
+ this.socketFactoryCreator = socketFactoryCreator;
+ }
+
/**
* Create a builder for a client using a custom SSLSocketFactoryCreator.
*
@@ -46,7 +62,6 @@ public JsseESTServiceBuilder(String server, SSLSocketFactoryCreator socketFactor
throw new NullPointerException("No socket factory creator.");
}
this.socketFactoryCreator = socketFactoryCreator;
-
}
/**
@@ -60,11 +75,24 @@ public JsseESTServiceBuilder(String server)
sslSocketFactoryCreatorBuilder = new SSLSocketFactoryCreatorBuilder(JcaJceUtils.getTrustAllTrustManager());
}
+ /**
+ * Create a builder for a client talking to a trusted server.
+ *
+ * @param hostName name of the server to talk to.
+ * @param portNo port number to connect on.
+ * @param trustManager trust manager to be used for validating the connection.
+ */
+ public JsseESTServiceBuilder(String hostName, int portNo, X509TrustManager trustManager)
+ {
+ super(hostName + ":" + portNo);
+ sslSocketFactoryCreatorBuilder = new SSLSocketFactoryCreatorBuilder(trustManager);
+ }
+
/**
* Create a builder for a client talking to a trusted server.
*
* @param server name of the server to talk to (URL format).
- * @param trustManager
+ * @param trustManager trust manager to be used for validating the connection.
*/
public JsseESTServiceBuilder(String server, X509TrustManager trustManager)
{
@@ -72,16 +100,28 @@ public JsseESTServiceBuilder(String server, X509TrustManager trustManager)
sslSocketFactoryCreatorBuilder = new SSLSocketFactoryCreatorBuilder(trustManager);
}
+ /**
+ * Create a builder for a client talking to a trusted server.
+ *
+ * @param hostName name of the server to talk to.
+ * @param portNo port number to connect on.
+ * @param trustManagers trust managers that can be used for validating the connection.
+ */
+ public JsseESTServiceBuilder(String hostName, int portNo, X509TrustManager[] trustManagers)
+ {
+ this(hostName + ":" + portNo, trustManagers);
+ }
+
/**
* Create a builder for a client talking to a trusted server.
*
* @param server name of the server to talk to (URL format).
- * @param trustManager
+ * @param trustManagers trust managers that can be used for validating the connection.
*/
- public JsseESTServiceBuilder(String server, X509TrustManager[] trustManager)
+ public JsseESTServiceBuilder(String server, X509TrustManager[] trustManagers)
{
super(server);
- sslSocketFactoryCreatorBuilder = new SSLSocketFactoryCreatorBuilder(trustManager);
+ sslSocketFactoryCreatorBuilder = new SSLSocketFactoryCreatorBuilder(trustManagers);
}
public JsseESTServiceBuilder withHostNameAuthorizer(JsseHostnameAuthorizer hostNameAuthorizer)
