|
3 | 3 | import static javasabr.rlib.network.util.NetworkUtils.createAllTrustedClientSslContext; |
4 | 4 | import static javasabr.rlib.network.util.NetworkUtils.createSslContext; |
5 | 5 | import static org.assertj.core.api.Assertions.assertThat; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; |
6 | 7 |
|
7 | 8 | import java.net.InetSocketAddress; |
| 9 | +import java.time.Duration; |
8 | 10 | import java.util.concurrent.CountDownLatch; |
9 | 11 | import java.util.concurrent.TimeUnit; |
10 | | -import javasabr.rlib.common.util.AwaitUtils; |
11 | 12 | import javasabr.rlib.network.exception.ConnectionClosedException; |
12 | 13 | import javasabr.rlib.network.impl.AbstractConnection; |
13 | 14 | import javasabr.rlib.network.impl.DefaultConnection; |
@@ -80,14 +81,16 @@ void shouldCloseServerConnectionWhenClientClosesTcpChannelAbruptly() { |
80 | 81 |
|
81 | 82 | // when |
82 | 83 | clientConnection.channel().close(); |
83 | | - assertThat(AwaitUtils.await(5, TimeUnit.SECONDS, clientConnection::closed)) |
84 | | - .as("Client connection should be closed prior server side verification") |
85 | | - .isTrue(); |
86 | 84 |
|
87 | 85 | // then |
88 | | - assertThat(AwaitUtils.await(5, TimeUnit.SECONDS, serverConnection::closed)) |
89 | | - .as("Server connection should be closed after receiving EOF from abruptly closed client channel") |
90 | | - .isTrue(); |
| 86 | + assertTimeoutPreemptively( |
| 87 | + Duration.ofSeconds(5), |
| 88 | + clientConnection::closed, |
| 89 | + "Client connection was not properly closed prior server side verification"); |
| 90 | + assertTimeoutPreemptively( |
| 91 | + Duration.ofSeconds(5), |
| 92 | + serverConnection::closed, |
| 93 | + "Server connection was not closed after receiving EOF from abruptly closed client channel"); |
91 | 94 | } |
92 | 95 | } |
93 | 96 | } |
0 commit comments