Skip to content

Commit 5c1683d

Browse files
committed
Fix forceTLS to useTLS in PusherOptions
1 parent c85f492 commit 5c1683d

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/main/java/com/pusher/client/PusherOptions.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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 forceTLS = true;
37+
private boolean useTLS = true;
3838
private long activityTimeout = DEFAULT_ACTIVITY_TIMEOUT;
3939
private long pongTimeout = DEFAULT_PONG_TIMEOUT;
4040
private Authorizer authorizer;
@@ -44,38 +44,38 @@ public class PusherOptions {
4444

4545
/**
4646
* @deprecated
47-
* Please use isForceTLS
47+
* Please use isUseTLS
4848
*/
4949
@Deprecated
5050
public boolean isEncrypted() {
51-
return forceTLS;
51+
return useTLS;
5252
}
5353

5454
/**
5555
* @deprecated
56-
* Please use setForceTLS
56+
* Please use setUseTLS
5757
*/
5858
@Deprecated
5959
public PusherOptions setEncrypted(final boolean encrypted) {
60-
this.forceTLS = encrypted;
60+
this.useTLS = encrypted;
6161
return this;
6262
}
6363

6464
/**
6565
*
6666
* @return whether the connection to Pusher should use TLS
6767
*/
68-
public boolean isForceTLS() {
69-
return forceTLS;
68+
public boolean isUseTLS() {
69+
return useTLS;
7070
}
7171

7272
/**
7373
* Sets whether the connection to Pusher should be use TLS.
74-
* @param forceTLS whether the connection should use TLS, by default this is true
74+
* @param useTLS whether the connection should use TLS, by default this is true
7575
* @return this, for chaining
7676
*/
77-
public PusherOptions setForceTLS(final boolean forceTLS) {
78-
this.forceTLS = forceTLS;
77+
public PusherOptions setUseTLS(final boolean useTLS) {
78+
this.useTLS = useTLS;
7979
return this;
8080
}
8181

@@ -237,7 +237,7 @@ public long getPongTimeout() {
237237
* @return the WebSocket URL
238238
*/
239239
public String buildUrl(final String apiKey) {
240-
return String.format("%s://%s:%s/app/%s%s", forceTLS ? WSS_SCHEME : WS_SCHEME, host, forceTLS ? wssPort
240+
return String.format("%s://%s:%s/app/%s%s", useTLS ? WSS_SCHEME : WS_SCHEME, host, useTLS ? wssPort
241241
: wsPort, apiKey, URI_SUFFIX);
242242
}
243243

src/test/java/com/pusher/client/PusherOptionsTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public void testEncryptedInitializedAsTrue() {
3232
}
3333

3434
@Test
35-
public void testForceTLSInitializedAsTrue() {
36-
assert pusherOptions.isForceTLS();
35+
public void testUseTLSInitializedAsTrue() {
36+
assert pusherOptions.isUseTLS();
3737
}
3838

3939
@Test
@@ -54,9 +54,9 @@ public void testEncryptedCanBeSetToTrue() {
5454
}
5555

5656
@Test
57-
public void testForceTLSCanBeSetToTrue() {
58-
pusherOptions.setForceTLS(true);
59-
assertSame(true, pusherOptions.isForceTLS());
57+
public void testUseTLSCanBeSetToTrue() {
58+
pusherOptions.setUseTLS(true);
59+
assertSame(true, pusherOptions.isUseTLS());
6060
}
6161

6262
@Test
@@ -70,8 +70,8 @@ public void testSetEncryptedReturnsSelf() {
7070
}
7171

7272
@Test
73-
public void testSetForceTLSReturnsSelf() {
74-
assertSame(pusherOptions, pusherOptions.setForceTLS(true));
73+
public void testSetUseTLSReturnsSelf() {
74+
assertSame(pusherOptions, pusherOptions.setUseTLS(true));
7575
}
7676

7777
@Test
@@ -82,7 +82,7 @@ public void testDefaultURL() {
8282

8383
@Test
8484
public void testNonSSLURLIsCorrect() {
85-
pusherOptions.setForceTLS(false);
85+
pusherOptions.setUseTLS(false);
8686
assertEquals(pusherOptions.buildUrl(API_KEY), "ws://ws.pusherapp.com:80/app/" + API_KEY
8787
+ "?client=java-client&protocol=5&version=" + PusherOptions.LIB_VERSION);
8888
}
@@ -96,7 +96,7 @@ public void testClusterSetURLIsCorrect() {
9696

9797
@Test
9898
public void testClusterSetNonSSLURLIsCorrect() {
99-
pusherOptions.setCluster("eu").setForceTLS(false);
99+
pusherOptions.setCluster("eu").setUseTLS(false);
100100
assertEquals(pusherOptions.buildUrl(API_KEY), "ws://ws-eu.pusher.com:80/app/" + API_KEY
101101
+ "?client=java-client&protocol=5&version=" + PusherOptions.LIB_VERSION);
102102
}
@@ -110,7 +110,7 @@ public void testCustomHostAndPortURLIsCorrect() {
110110

111111
@Test
112112
public void testCustomHostAndPortNonSSLURLIsCorrect() {
113-
pusherOptions.setHost("subdomain.example.com").setWsPort(8080).setWssPort(8181).setForceTLS(false);
113+
pusherOptions.setHost("subdomain.example.com").setWsPort(8080).setWssPort(8181).setUseTLS(false);
114114
assertEquals(pusherOptions.buildUrl(API_KEY), "ws://subdomain.example.com:8080/app/" + API_KEY
115115
+ "?client=java-client&protocol=5&version=" + PusherOptions.LIB_VERSION);
116116
}

0 commit comments

Comments
 (0)