Skip to content

Commit

Permalink
Evict connection pool a second time after tests (#7819)
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed May 14, 2023
1 parent f62fd47 commit e2344c7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class OkHttpClientTestRule : BeforeEachCallback, AfterEachCallback {
println("After delay: " + connectionPool.connectionCount())
}

connectionPool.evictAll()
assertEquals(0, connectionPool.connectionCount()) {
"Still ${connectionPool.connectionCount()} connections open"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e2344c7

Please sign in to comment.