From cff1827e27bd31ab685c32963517dcc7f0476523 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Sat, 24 Jul 2021 09:43:41 +0100 Subject: [PATCH] Stabilize socketChannelClosedTriggersTunnelClose Closes gh-27483 --- .../boot/devtools/tunnel/client/TunnelClientTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java index da6eb662b1..1ac57b1bdb 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java @@ -72,7 +72,8 @@ class TunnelClientTests { TunnelClient client = new TunnelClient(0, this.tunnelConnection); int port = client.start(); SocketChannel channel = SocketChannel.open(new InetSocketAddress(port)); - Thread.sleep(200); + Awaitility.await().atMost(Duration.ofSeconds(30)).until(this.tunnelConnection::getOpenedTimes, + (open) -> open == 1); channel.close(); client.getServerThread().stopAcceptingConnections(); client.getServerThread().join(2000);