Search in sources :

Example 1 with CacheControlRequestInterceptor

use of org.wikipedia.dataclient.okhttp.CacheControlRequestInterceptor in project apps-android-wikipedia by wikimedia.

the class MockWebServerTest method setUp.

@Before
public void setUp() throws Throwable {
    OkHttpClient.Builder builder = OkHttpConnectionFactory.getClient().newBuilder();
    // Most tests do not expect cached responses.
    // noinspection Since15
    builder.interceptors().removeIf((interceptor) -> interceptor instanceof CacheControlRequestInterceptor);
    okHttpClient = builder.dispatcher(new Dispatcher(new ImmediateExecutorService())).build();
    server.setUp();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) CacheControlRequestInterceptor(org.wikipedia.dataclient.okhttp.CacheControlRequestInterceptor) Dispatcher(okhttp3.Dispatcher) Before(org.junit.Before)

Aggregations

Dispatcher (okhttp3.Dispatcher)1 OkHttpClient (okhttp3.OkHttpClient)1 Before (org.junit.Before)1 CacheControlRequestInterceptor (org.wikipedia.dataclient.okhttp.CacheControlRequestInterceptor)1