Search in sources :

Example 1 with Flaky

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();
}
Also used : MockResponse(mockwebserver3.MockResponse) MockResponse(mockwebserver3.MockResponse) Flaky(okhttp3.testing.Flaky) Test(org.junit.jupiter.api.Test)

Aggregations

MockResponse (mockwebserver3.MockResponse)1 Flaky (okhttp3.testing.Flaky)1 Test (org.junit.jupiter.api.Test)1