- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 18 for addNetworkInterceptor (0.1 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/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) -
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) -
okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt
fun addNetworkInterceptor(interceptor: Interceptor) = apply { networkInterceptors += interceptor } @JvmName("-addNetworkInterceptor") // Prefix with '-' to prevent ambiguous overloads from Java. inline fun addNetworkInterceptor(crossinline block: (chain: Interceptor.Chain) -> Response) = addNetworkInterceptor(Interceptor { chain -> block(chain) }) /**
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Apr 06 04:21:33 UTC 2024 - 52K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/OkHttpClientTest.kt
Interceptor { chain: Interceptor.Chain -> chain.proceed(chain.request()) } val original = clientTestRule.newClient() original.newBuilder() .addInterceptor(interceptor) .addNetworkInterceptor(interceptor) .build() assertThat(original.interceptors.size).isEqualTo(0) assertThat(original.networkInterceptors.size).isEqualTo(0) } /**
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Mar 31 17:16:15 UTC 2024 - 13.2K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/ConnectionReuseTest.kt
// Since this test knowingly leaks a connection, avoid using the default shared connection // pool, which should remain clean for subsequent tests. .connectionPool(ConnectionPool()) .addNetworkInterceptor( Interceptor { chain: Interceptor.Chain? -> val response = chain!!.proceed( chain.request(), ) responsesNotClosed.add(response)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 12.3K bytes - Viewed (0)