Skip to content

Commit

Permalink
Merge pull request #4493 from amirlivneh/fix-test-connection-leak
Browse files Browse the repository at this point in the history
Ensure streams are removed from connection within test lifetime
  • Loading branch information
swankjesse authored Dec 30, 2018
2 parents e9619ed + 7e53755 commit 2c3eb51
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -896,15 +896,18 @@ private void callAndCancel(int expectedSequenceNumber) throws Exception {
Call call = client.newCall(new Request.Builder()
.url(server.url("/"))
.build());
final CountDownLatch latch = new CountDownLatch(1);
call.enqueue(new Callback() {
@Override public void onFailure(Call call1, IOException e) {
latch.countDown();
}

@Override public void onResponse(Call call1, Response response) {
}
});
assertEquals(expectedSequenceNumber, server.takeRequest().getSequenceNumber());
call.cancel();
latch.await();
}

@Test public void noRecoveryFromRefusedStreamWithRetryDisabled() throws Exception {
Expand Down

0 comments on commit 2c3eb51

Please sign in to comment.