Skip to content

Commit e30b867

Browse files
committed
TestValidateAfterInactivity: Use closeQuietly
1 parent 43d35fc commit e30b867

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

httpclient5-testing/src/test/java/org/apache/hc/client5/testing/TestValidateAfterInactivity.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
package org.apache.hc.client5.testing;
2929

30+
import org.apache.commons.io.IOUtils;
3031
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
3132
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
3233
import org.apache.hc.client5.http.async.methods.SimpleRequestBuilder;
@@ -90,13 +91,8 @@ void setup() throws Exception {
9091
@AfterEach
9192
void tearDown() throws Exception {
9293
final SocketChannel socket = currentConnection.getAndSet(null);
93-
if (socket != null) {
94-
socket.close();
95-
}
96-
97-
if (serverSocket != null) {
98-
serverSocket.close();
99-
}
94+
IOUtils.closeQuietly(socket);
95+
IOUtils.closeQuietly(serverSocket);
10096
if (serverThread != null) {
10197
serverThread.interrupt();
10298
serverThread.join(1000);

0 commit comments

Comments
 (0)