Skip to content

Commit

Permalink
[improve][test] Use channel.advanceTimeBy instead of Thread.sleep (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljmarshall authored Feb 7, 2023
1 parent fd3ce8b commit 88fa40b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void testKeepAlive() throws Exception {
// Connection will be closed in 2 seconds, in the meantime give chance to run the cleanup logic
for (int i = 0; i < 3; i++) {
channel.runPendingTasks();
Thread.sleep(1000);
channel.advanceTimeBy(1, TimeUnit.SECONDS);
}

assertFalse(channel.isActive());
Expand All @@ -334,7 +334,7 @@ public void testKeepAliveNotEnforcedWithOlderClients() throws Exception {
// Connection will *not* be closed in 2 seconds
for (int i = 0; i < 3; i++) {
channel.runPendingTasks();
Thread.sleep(1000);
channel.advanceTimeBy(1, TimeUnit.SECONDS);
}
assertTrue(channel.isActive());

Expand All @@ -352,7 +352,7 @@ public void testKeepAliveBeforeHandshake() throws Exception {
// Connection will be closed in 2 seconds, in the meantime give chance to run the cleanup logic
for (int i = 0; i < 3; i++) {
channel.runPendingTasks();
Thread.sleep(1000);
channel.advanceTimeBy(1, TimeUnit.SECONDS);
}

assertFalse(channel.isActive());
Expand Down

0 comments on commit 88fa40b

Please sign in to comment.