From dc7dd6a28017cc79edcdebb678817b7513a443c7 Mon Sep 17 00:00:00 2001 From: "Sergey G. Grekhov" Date: Tue, 10 Oct 2023 13:16:50 +0300 Subject: [PATCH] Fixes #2268. Fix LibTest/io/WebSocket/closeCode_A01_t02.dart to be not racy (#2302) --- LibTest/io/WebSocket/closeCode_A01_t02.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/LibTest/io/WebSocket/closeCode_A01_t02.dart b/LibTest/io/WebSocket/closeCode_A01_t02.dart index 85ef48c6a2..d12b8f9283 100644 --- a/LibTest/io/WebSocket/closeCode_A01_t02.dart +++ b/LibTest/io/WebSocket/closeCode_A01_t02.dart @@ -16,9 +16,7 @@ import "../../../Utils/expect.dart"; main() { HttpServer.bind("127.0.0.1", 0).then((server) { server.listen((request) { - WebSocketTransformer - .upgrade(request) - .then((websocket) { + WebSocketTransformer.upgrade(request).then((websocket) { websocket.close(WebSocketStatus.normalClosure); }); }); @@ -26,6 +24,7 @@ main() { var webs = WebSocket.connect("ws://127.0.0.1:${server.port}/"); webs.then((client) async { Expect.isNull(client.closeCode); + await client.listen((_) {}).asFuture(); await server.close(); client.close().then((_) { Expect.equals(WebSocketStatus.normalClosure, client.closeCode);