diff --git a/okhttp-testing-support/src/jvmMain/kotlin/okhttp3/OkHttpClientTestRule.kt b/okhttp-testing-support/src/jvmMain/kotlin/okhttp3/OkHttpClientTestRule.kt index 811b6e19645f..89ed00066a51 100644 --- a/okhttp-testing-support/src/jvmMain/kotlin/okhttp3/OkHttpClientTestRule.kt +++ b/okhttp-testing-support/src/jvmMain/kotlin/okhttp3/OkHttpClientTestRule.kt @@ -190,6 +190,7 @@ class OkHttpClientTestRule : BeforeEachCallback, AfterEachCallback { println("After delay: " + connectionPool.connectionCount()) } + connectionPool.evictAll() assertEquals(0, connectionPool.connectionCount()) { "Still ${connectionPool.connectionCount()} connections open" } diff --git a/okhttp/src/jvmTest/java/okhttp3/internal/ws/WebSocketHttpTest.java b/okhttp/src/jvmTest/java/okhttp3/internal/ws/WebSocketHttpTest.java index 3f7eef947bf3..9d8fa4c0a32a 100644 --- a/okhttp/src/jvmTest/java/okhttp3/internal/ws/WebSocketHttpTest.java +++ b/okhttp/src/jvmTest/java/okhttp3/internal/ws/WebSocketHttpTest.java @@ -909,11 +909,6 @@ private OkHttpClientTestRule configureClientTestRule() { /** https://github.com/square/okhttp/issues/7768 */ @Test public void reconnectingToNonWebSocket() throws InterruptedException { - // Async test is problematic - client = this.client.newBuilder() - .connectionPool(new ConnectionPool()) - .build(); - for (int i = 0; i < 30; i++) { webServer.enqueue(new MockResponse.Builder() .bodyDelay(100, TimeUnit.MILLISECONDS) @@ -950,8 +945,6 @@ public void onFailure(WebSocket webSocket, Throwable t, Response response) { for (WebSocket webSocket: webSockets) { webSocket.cancel(); } - client.dispatcher().cancelAll(); - client.connectionPool().evictAll(); } @Test public void compressedMessages() throws Exception {