mirror of
https://github.com/layue13/MoonBridge.git
synced 2026-10-25 18:46:18 +00:00
Await session capacity release in disconnect tests
This commit is contained in:
1 parent
112efd839d
commit
c909f6a0e2
1 file changed
+9
@@ -1176,6 +1176,9 @@ final class ProxySessionListenerTest {
|
||||
new ObjectMapper().readTree(readString(packet, 32767)).path("text").asText());
|
||||
assertEquals(-1, encryptedInput.read());
|
||||
}
|
||||
long cleanupDeadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
|
||||
while (catalog.find(registration.handle().id()).orElseThrow().availableUnits() != 1
|
||||
&& System.nanoTime() < cleanupDeadline) Thread.sleep(5);
|
||||
assertEquals(1, catalog.find(registration.handle().id()).orElseThrow().availableUnits());
|
||||
} finally {
|
||||
listener.close().toCompletableFuture().get(5, TimeUnit.SECONDS);
|
||||
@@ -1316,6 +1319,9 @@ final class ProxySessionListenerTest {
|
||||
"the stalled login disconnect write must not keep the session open forever");
|
||||
}
|
||||
assertEquals(-1, input.read());
|
||||
long cleanupDeadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
|
||||
while (catalog.find(new BackendId("lobby")).orElseThrow().reservedCapacity() != 0
|
||||
&& System.nanoTime() < cleanupDeadline) Thread.sleep(5);
|
||||
assertEquals(0, catalog.find(new BackendId("lobby")).orElseThrow().reservedCapacity());
|
||||
}
|
||||
} finally {
|
||||
@@ -1591,6 +1597,9 @@ final class ProxySessionListenerTest {
|
||||
assertEquals(-1, input.read());
|
||||
}
|
||||
assertTrue(listener.online().isEmpty());
|
||||
long cleanupDeadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
|
||||
while (catalog.find(backend.handle().id()).orElseThrow().availableUnits() != 1
|
||||
&& System.nanoTime() < cleanupDeadline) Thread.sleep(5);
|
||||
assertEquals(1, catalog.find(backend.handle().id()).orElseThrow().availableUnits());
|
||||
} finally {
|
||||
listener.close().toCompletableFuture().get(5, TimeUnit.SECONDS);
|
||||
|
||||
Reference in new issue
Block a user