- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 21 for addNetworkInterceptor (0.17 sec)
-
okhttp/src/test/java/okhttp3/InterceptorTest.kt
.message("Intercepted!") .body("abc".toResponseBody("text/plain; charset=utf-8".toMediaType())) .build() } client = client.newBuilder() .addNetworkInterceptor(interceptor) .build() val request = Request.Builder() .url(server.url("/")) .build() assertFailsWith<IllegalStateException> { client.newCall(request).execute()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Jan 14 10:20:09 UTC 2024 - 27.8K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.kt
fun staleCoalescedConnection() { server.enqueue(MockResponse()) server.enqueue(MockResponse()) val connection = AtomicReference<Connection?>() client = client.newBuilder() .addNetworkInterceptor( Interceptor { chain: Interceptor.Chain? -> connection.set(chain!!.connection()) chain.proceed(chain.request()) }, ) .build()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 20 10:30:28 UTC 2024 - 18.7K bytes - Viewed (0) -
okhttp-logging-interceptor/src/test/java/okhttp3/logging/HttpLoggingInterceptorTest.kt
this.server = server client = OkHttpClient.Builder() .addNetworkInterceptor( Interceptor { chain -> when { extraNetworkInterceptor != null -> extraNetworkInterceptor!!.intercept(chain) else -> chain.proceed(chain.request()) } }, ) .addNetworkInterceptor(networkInterceptor) .addInterceptor(applicationInterceptor)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Apr 06 09:14:38 UTC 2024 - 37.6K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/Progress.java
System.out.format("%d%% done\n", (100 * bytesRead) / contentLength); } } } }; OkHttpClient client = new OkHttpClient.Builder() .addNetworkInterceptor(chain -> { Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener))
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 12 03:31:36 UTC 2019 - 3.9K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/CheckHandshake.java
} } return chain.proceed(chain.request()); } }; private final OkHttpClient client = new OkHttpClient.Builder() .addNetworkInterceptor(CHECK_HANDSHAKE_INTERCEPTOR) .build(); public void run() throws Exception { Request request = new Request.Builder() .url("https://publicobject.com/helloworld.txt") .build();
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Apr 15 14:55:09 UTC 2024 - 2.1K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/RewriteResponseCacheControl.java
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 12 03:31:36 UTC 2019 - 2.6K bytes - Viewed (0) -
docs/features/interceptors.md
### Network Interceptors Registering a network interceptor is quite similar. Call `addNetworkInterceptor()` instead of `addInterceptor()`: ```java OkHttpClient client = new OkHttpClient.Builder() .addNetworkInterceptor(new LoggingInterceptor()) .build(); Request request = new Request.Builder() .url("http://www.publicobject.com/helloworld.txt")
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Feb 06 02:19:09 UTC 2022 - 8.1K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/FastFallbackTest.kt
return super.createSocket() } } client = client.newBuilder() .protocols(listOf(Protocol.H2_PRIOR_KNOWLEDGE)) .socketFactory(socketFactory) .addNetworkInterceptor( Interceptor { chain -> try { chain.proceed(chain.request()) } finally { firstConnectLatch.countDown() } },
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 10.3K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/CallHandshakeTest.kt
cipherSuites(*cipherSuites.toTypedArray()) } } .build(), ), ) } } .addNetworkInterceptor { val socket = it.connection()!!.socket() as SSLSocket handshakeEnabledCipherSuites = socket.enabledCipherSuites.toList() it.proceed(it.request()) } .build()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 20 10:30:28 UTC 2024 - 11.2K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/CallKotlinTest.kt
// Capture the connection so that we can later make it stale. var connection: RealConnection? = null client = client.newBuilder() .addNetworkInterceptor( Interceptor { chain -> connection = chain.connection() as RealConnection chain.proceed(chain.request()) }, ) .build()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 20 10:30:28 UTC 2024 - 8.4K bytes - Viewed (0)