Skip to content

Commit 00b9e7f

Browse files
committed
Merge branch '2.4.x' into 2.5.x
Closes gh-26868
2 parents 1a828af + 186658c commit 00b9e7f

File tree

1 file changed

+6
-3
lines changed
  • spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client

1 file changed

+6
-3
lines changed

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,9 @@
2424
import java.nio.channels.Channels;
2525
import java.nio.channels.SocketChannel;
2626
import java.nio.channels.WritableByteChannel;
27+
import java.time.Duration;
2728

29+
import org.awaitility.Awaitility;
2830
import org.junit.jupiter.api.Test;
2931

3032
import static org.assertj.core.api.Assertions.assertThat;
@@ -85,9 +87,10 @@ void stopTriggersTunnelClose() throws Exception {
8587
TunnelClient client = new TunnelClient(0, this.tunnelConnection);
8688
int port = client.start();
8789
SocketChannel channel = SocketChannel.open(new InetSocketAddress(port));
88-
Thread.sleep(200);
90+
Awaitility.await().atMost(Duration.ofSeconds(30)).until(this.tunnelConnection::getOpenedTimes,
91+
(times) -> times == 1);
92+
assertThat(this.tunnelConnection.isOpen()).isTrue();
8993
client.stop();
90-
assertThat(this.tunnelConnection.getOpenedTimes()).isEqualTo(1);
9194
assertThat(this.tunnelConnection.isOpen()).isFalse();
9295
assertThat(channel.read(ByteBuffer.allocate(1))).isEqualTo(-1);
9396
}

0 commit comments

Comments
 (0)