diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-11-15 15:28:28 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-11-15 15:28:28 +0000 |
commit | 7f5cda33dd04f0e9019cbad6ca11232f01193441 (patch) | |
tree | 639b7105d88707c56681b42e879c6ba129998b11 | |
parent | 839e7375ce6a62b379f09a3c543bae4a2af5ef7e (diff) | |
parent | 0447f60a5216634377ccb32abef4475edabdee7d (diff) | |
download | okhttp-7f5cda33dd04f0e9019cbad6ca11232f01193441.tar.gz |
Snap for 7915578 from 0447f60a5216634377ccb32abef4475edabdee7d to mainline-sdkext-releaseandroid-mainline-12.0.0_r81android-mainline-12.0.0_r109aml_sdk_311710000android12-mainline-sdkext-release
Change-Id: I8e3f9d567b1c50074cd5d40dce3b06b5ace8dbea
-rw-r--r-- | okhttp-tests/src/test/java/com/squareup/okhttp/CallTest.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/CallTest.java b/okhttp-tests/src/test/java/com/squareup/okhttp/CallTest.java index 3d48658..0b18783 100644 --- a/okhttp-tests/src/test/java/com/squareup/okhttp/CallTest.java +++ b/okhttp-tests/src/test/java/com/squareup/okhttp/CallTest.java @@ -1650,9 +1650,16 @@ public final class CallTest { } @Test public void cancelInFlightBeforeResponseReadThrowsIOE() throws Exception { + final CountDownLatch cancelSignal = new CountDownLatch(1); + server.setDispatcher(new Dispatcher() { @Override public MockResponse dispatch(RecordedRequest request) { client.cancel("request"); + try { + cancelSignal.await(10L, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // Do nothing + } return new MockResponse().setBody("A"); } }); @@ -1662,6 +1669,7 @@ public final class CallTest { client.newCall(request).execute(); fail(); } catch (IOException expected) { + cancelSignal.countDown(); } } |