@@ -34,7 +34,7 @@ public class PusherOptions {
3434 private String host = "ws.pusherapp.com" ;
3535 private int wsPort = WS_PORT ;
3636 private int wssPort = WSS_PORT ;
37- private boolean encrypted = true ;
37+ private boolean forceTLS = true ;
3838 private long activityTimeout = DEFAULT_ACTIVITY_TIMEOUT ;
3939 private long pongTimeout = DEFAULT_PONG_TIMEOUT ;
4040 private Authorizer authorizer ;
@@ -43,24 +43,39 @@ public class PusherOptions {
4343 private int maxReconnectGapInSeconds = MAX_RECONNECT_GAP_IN_SECONDS ;
4444
4545 /**
46- * Gets whether an encrypted (SSL) connection should be used when connecting
47- * to Pusher.
48- *
49- * @return true if an encrypted connection should be used; otherwise false.
46+ * @deprecated
47+ * Please use isForceTLS
5048 */
49+ @ Deprecated
5150 public boolean isEncrypted () {
52- return encrypted ;
51+ return forceTLS ;
52+ }
53+
54+ /**
55+ * @deprecated
56+ * Please use setForceTLS
57+ */
58+ @ Deprecated
59+ public PusherOptions setEncrypted (final boolean encrypted ) {
60+ this .forceTLS = encrypted ;
61+ return this ;
5362 }
5463
5564 /**
56- * Sets whether an encrypted (SSL) connection should be used when connecting to
57- * Pusher.
5865 *
59- * @param encrypted Whether to use an SSL connection
66+ * @return whether the connection to Pusher should use TLS
67+ */
68+ public boolean isForceTLS () {
69+ return forceTLS ;
70+ }
71+
72+ /**
73+ * Sets whether the connection to Pusher should be use TLS.
74+ * @param forceTLS whether the connection should use TLS, by default this is true
6075 * @return this, for chaining
6176 */
62- public PusherOptions setEncrypted ( final boolean encrypted ) {
63- this .encrypted = encrypted ;
77+ public PusherOptions setForceTLS ( boolean forceTLS ) {
78+ this .forceTLS = forceTLS ;
6479 return this ;
6580 }
6681
@@ -103,7 +118,7 @@ public PusherOptions setHost(final String host) {
103118 }
104119
105120 /**
106- * The port to which unencrypted connections will be made.
121+ * The port to which non TLS connections will be made.
107122 *
108123 * Note that if you wish to connect to a standard Pusher cluster, the
109124 * convenience method setCluster will set the host and ports correctly from
@@ -222,7 +237,7 @@ public long getPongTimeout() {
222237 * @return the WebSocket URL
223238 */
224239 public String buildUrl (final String apiKey ) {
225- return String .format ("%s://%s:%s/app/%s%s" , encrypted ? WSS_SCHEME : WS_SCHEME , host , encrypted ? wssPort
240+ return String .format ("%s://%s:%s/app/%s%s" , forceTLS ? WSS_SCHEME : WS_SCHEME , host , forceTLS ? wssPort
226241 : wsPort , apiKey , URI_SUFFIX );
227242 }
228243
0 commit comments