use of okhttp3.testing.Flaky in project okhttp by square.
the class WholeOperationTimeoutTest method noTimeout.
@Flaky
@Test
public void noTimeout() throws Exception {
// Flaky https://github.com/square/okhttp/issues/5304
server.enqueue(new MockResponse().setHeadersDelay(250, TimeUnit.MILLISECONDS).setBody(BIG_ENOUGH_BODY));
Request request = new Request.Builder().url(server.url("/")).post(sleepingRequestBody(250)).build();
Call call = client.newCall(request);
call.timeout().timeout(2000, TimeUnit.MILLISECONDS);
Response response = call.execute();
Thread.sleep(250);
response.body().source().readUtf8();
response.close();
assertThat(call.isCanceled()).isFalse();
}
Aggregations