Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Commit 879017d

Browse files
committed
Fixed unit tests
1 parent 6fc88cb commit 879017d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/test/java/com/clusterws/ChannelServerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ChannelServerTest {
1616

1717
@Before
1818
public void init() throws Exception {
19-
mClusterWS = new ClusterWS("ws://localhost:80");
19+
mClusterWS = new ClusterWS("ws://localhost:3000");
2020
mGotTheData = false;
2121
mReceivedData = null;
2222
}
@@ -189,7 +189,7 @@ public void onDataReceived(String channelName, Object data) {
189189
}
190190
});
191191
mClusterWS.disconnect(4001, "hui");
192-
Thread.sleep(1000);
192+
Thread.sleep(3000);
193193
channel.publish("testData");
194194
Thread.sleep(1000);
195195
assertTrue("Did not get the data", mGotTheData);

src/test/java/com/clusterws/ClusterWSTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class ClusterWSTest {
2020

2121
@Before
2222
public void init() {
23-
mClusterWS = new ClusterWS("ws://localhost:80");
23+
mClusterWS = new ClusterWS("ws://localhost:3000");
2424
receivedData = null;
2525
gotTheData = false;
2626
}
@@ -36,7 +36,7 @@ public void connect() throws Exception {
3636
mClusterWS.connect();
3737
Thread.sleep(1000);
3838

39-
assertEquals("Socket did not connect", WebSocket.READYSTATE.OPEN,mClusterWS.getState());
39+
assertEquals("Socket did not connect", WebSocket.READYSTATE.OPEN, mClusterWS.getState());
4040
}
4141

4242
@Test
@@ -233,24 +233,24 @@ public void onDisconnected(int code, String reason) {
233233
}
234234

235235
@Test
236-
public void testReconnection() throws Exception{
237-
mClusterWS.setReconnection(true,1000,2000,null);
236+
public void testReconnection() throws Exception {
237+
mClusterWS.setReconnection(true, 1000, 2000, null);
238238
mClusterWS.connect();
239239
Thread.sleep(1000);
240-
mClusterWS.disconnect(3002,"test");
241-
Thread.sleep(2000);
240+
mClusterWS.disconnect(3002, "test");
241+
Thread.sleep(4000);
242242
assertEquals("Did not reconnect", WebSocket.READYSTATE.OPEN, mClusterWS.getState());
243243
}
244244

245245
@Test
246-
public void testPingPong() throws Exception{
246+
public void testPingPong() throws Exception {
247247
mClusterWS.connect();
248248
Thread.sleep(1900);
249-
assertEquals("Websocket disconnected", WebSocket.READYSTATE.OPEN,mClusterWS.getState());
249+
assertEquals("Websocket disconnected", WebSocket.READYSTATE.OPEN, mClusterWS.getState());
250250
}
251251

252252
@Test(expected = NullPointerException.class)
253-
public void testNullUrl() throws Exception{
253+
public void testNullUrl() throws Exception {
254254
mClusterWS = new ClusterWS(null);
255255
}
256256

0 commit comments

Comments
 (0)