CronetInterceptor

public final class CronetInterceptor implements Interceptor, AutoCloseable


An OkHttp interceptor that redirects HTTP traffic to use Cronet instead of using the OkHttp network stack.

The interceptor should be used as the last application interceptor to ensure that all other interceptors are visited before sending the request on wire and after a response is returned.

The interceptor is a plug-and-play replacement for the OkHttp stack for the most part, however, there are some caveats to keep in mind:

  1. The entirety of OkHttp core is bypassed. This includes caching configuration and network interceptors.
  2. Some response fields are not being populated due to mismatches between Cronet's and OkHttp's architecture. TODO(danstahr): add a concrete list).

Summary

Nested types

public final class CronetInterceptor.Builder

A builder for CronetInterceptor.

Public methods

void
Response
static CronetInterceptor.Builder
newBuilder(CronetEngine cronetEngine)

Creates a CronetInterceptor builder.

Inherited Constants

From okhttp3.Interceptor

Public methods

close

public void close()

intercept

public Response intercept(Interceptor.Chain chain)

newBuilder

public static CronetInterceptor.Builder newBuilder(CronetEngine cronetEngine)

Creates a CronetInterceptor builder.