Skip to content

Commit 8a97744

Browse files
authored
test (#16)
1 parent f861ba2 commit 8a97744

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

kmp-socketio/src/jvmTest/java/io/socket/client/Connection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
public abstract class Connection {
1919

20-
private static final String TAG = "TestConnection";
20+
protected static final String TAG = "TestConnection";
2121
final static int TIMEOUT = 7000;
2222
final static int PORT = 3000;
2323

kmp-socketio/src/jvmTest/java/io/socket/client/ConnectionTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.piasy.kmp.socketio.socketio.IO;
77
import com.piasy.kmp.socketio.socketio.Manager;
88
import com.piasy.kmp.socketio.socketio.Socket;
9+
import com.piasy.kmp.xlog.Logging;
10+
911
import kotlin.Unit;
1012
import kotlinx.io.bytestring.ByteString;
1113
import kotlinx.serialization.json.*;
@@ -454,7 +456,7 @@ public void reconnectDelayShouldIncreaseEveryTime() throws InterruptedException
454456
opts.reconnection = true;
455457
opts.timeout = 0;
456458
opts.reconnectionAttempts = 3;
457-
opts.setReconnectionDelay(100);
459+
opts.setReconnectionDelay(1000);
458460
opts.setRandomizationFactor(0.2);
459461
final Manager manager = new Manager(uri(), opts, TestUtil.testScope());
460462
socket = TestUtil.socket(manager, "/timeout");
@@ -468,6 +470,7 @@ public void reconnectDelayShouldIncreaseEveryTime() throws InterruptedException
468470
@Override
469471
public void call(Object... args) {
470472
startTime[0] = new Date().getTime();
473+
Logging.INSTANCE.info(TAG, "reconnectDelayShouldIncreaseEveryTime startTime " + startTime[0]);
471474
}
472475
});
473476
manager.on(Manager.EVENT_RECONNECT_ATTEMPT, new Emitter.Listener() {
@@ -476,6 +479,8 @@ public void call(Object... args) {
476479
reconnects[0]++;
477480
long currentTime = new Date().getTime();
478481
long delay = currentTime - startTime[0];
482+
Logging.INSTANCE.info(TAG, "reconnectDelayShouldIncreaseEveryTime currentTime "
483+
+ currentTime + ", delay " + delay + ", prevDelay " + prevDelay[0]);
479484
if (delay <= prevDelay[0]) {
480485
increasingDelay[0] = false;
481486
}

kmp-socketio/src/jvmTest/java/io/socket/client/ServerConnectionTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import kotlinx.serialization.json.JsonElementBuildersKt;
1515
import kotlinx.serialization.json.JsonElementKt;
1616
import kotlinx.serialization.json.JsonObject;
17-
import org.json.JSONObject;
1817
import org.junit.Test;
1918
import org.junit.runner.RunWith;
2019
import org.junit.runners.JUnit4;

0 commit comments

Comments
 (0)