diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java index 7cc4d35401..302835632b 100644 --- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java @@ -236,7 +236,6 @@ class WebSocketConnectionLifecycleTest { WebSocket ws = connectWebSocket(wsApiId, "test"); assertNotNull(ws, "WebSocket connection should succeed when no $connect route is defined"); ws.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); - Thread.sleep(500); } // ──────────────────────────── Test 2: Connect with $connect route Lambda allow ──────────────────────────── @@ -259,7 +258,6 @@ class WebSocketConnectionLifecycleTest { WebSocket ws = connectWebSocket(wsApiId, "test"); assertNotNull(ws, "WebSocket connection should succeed when $connect Lambda returns 200"); ws.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); - Thread.sleep(500); } // ──────────────────────────── Test 3: Connect with $connect route Lambda deny ──────────────────────────── @@ -331,8 +329,6 @@ class WebSocketConnectionLifecycleTest { WebSocket ws = connectWebSocket(wsApiId, "test"); assertNotNull(ws); ws.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); - // Give time for the $disconnect handler to execute - Thread.sleep(2000); } // ──────────────────────────── Test 6: Disconnect cleans up connection ──────────────────────────── @@ -344,14 +340,11 @@ class WebSocketConnectionLifecycleTest { WebSocket ws = connectWebSocket(wsApiId, "test"); assertNotNull(ws); ws.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); - // Give time for cleanup - Thread.sleep(2000); // Attempting to reconnect should work (proving old connection was cleaned up) WebSocket ws2 = connectWebSocket(wsApiId, "test"); assertNotNull(ws2); ws2.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); - Thread.sleep(500); } // ──────────────────────────── Test 7: Disconnect error does not propagate to client ──────────────────────────── @@ -376,8 +369,6 @@ class WebSocketConnectionLifecycleTest { // The close should complete normally ws.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); - // Give time for the $disconnect handler to execute (and fail) - Thread.sleep(2000); // If we got here without exception, the error was not propagated } @@ -441,7 +432,6 @@ class WebSocketConnectionLifecycleTest { for (WebSocket ws : connections) { ws.sendClose(WebSocket.NORMAL_CLOSURE, "done").join(); } - Thread.sleep(1000); } // ──────────────────────────── Cleanup ────────────────────────────