Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 20 for addNetworkInterceptor (0.13 seconds)

  1. okhttp/src/jvmTest/kotlin/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> {
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Nov 04 16:11:23 GMT 2025
    - 28.2K bytes
    - Click Count (0)
  2. okhttp/src/jvmTest/kotlin/okhttp3/ConnectionCoalescingTest.kt

        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()
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Thu Jun 19 11:44:16 GMT 2025
    - 19.1K bytes
    - Click Count (0)
  3. okhttp-logging-interceptor/src/test/java/okhttp3/logging/HttpLoggingInterceptorTest.kt

      fun setUp() {
        client =
          OkHttpClient
            .Builder()
            .addNetworkInterceptor(
              Interceptor { chain ->
                when {
                  extraNetworkInterceptor != null -> extraNetworkInterceptor!!.intercept(chain)
                  else -> chain.proceed(chain.request())
                }
              },
            ).addNetworkInterceptor(networkInterceptor)
            .addInterceptor(applicationInterceptor)
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Fri Nov 07 02:57:33 GMT 2025
    - 39.4K bytes
    - Click Count (0)
  4. 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();
    
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Mon Apr 15 14:55:09 GMT 2024
    - 2.1K bytes
    - Click Count (0)
  5. okhttp/src/jvmTest/kotlin/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()
    
        server.enqueue(
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Fri Jun 20 11:46:46 GMT 2025
    - 8.4K bytes
    - Click Count (0)
  6. okhttp/src/jvmTest/kotlin/okhttp3/CallHandshakeTest.kt

                      if (cipherSuites != null) {
                        cipherSuites(*cipherSuites.toTypedArray())
                      }
                    }.build(),
                ),
              )
            }
          }.addNetworkInterceptor {
            val socket = it.connection()!!.socket() as SSLSocket
    
            handshakeEnabledCipherSuites = socket.enabledCipherSuites.toList()
    
            it.proceed(it.request())
          }.build()
    
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Sep 16 07:21:43 GMT 2025
    - 11.4K bytes
    - Click Count (0)
  7. okhttp/src/jvmTest/kotlin/okhttp3/InterceptorOverridesTest.kt

          }
        }
    
        with(override.override) {
          client =
            client
              .newBuilder()
              .addInterceptor { chain ->
                testApplicationInterceptor(chain)
              }.addNetworkInterceptor { chain ->
                assertThat(isDefaultValue(chain.value())).isFalse()
                chain.proceed(chain.request())
              }.build()
    
          server.enqueue(
            MockResponse(),
          )
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Wed Mar 11 02:37:00 GMT 2026
    - 28.8K bytes
    - Click Count (0)
  8. okhttp/src/jvmTest/kotlin/okhttp3/OkHttpClientTest.kt

            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)
      }
    
      /**
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Feb 03 22:17:59 GMT 2026
    - 13.4K bytes
    - Click Count (1)
  9. okhttp/src/jvmTest/kotlin/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)
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Jan 27 09:00:39 GMT 2026
    - 12.3K bytes
    - Click Count (1)
  10. okhttp/src/jvmTest/kotlin/okhttp3/FastFallbackTest.kt

            }
          }
    
        client =
          client
            .newBuilder()
            .protocols(listOf(Protocol.H2_PRIOR_KNOWLEDGE))
            .socketFactory(socketFactory)
            .addNetworkInterceptor(
              Interceptor { chain ->
                try {
                  chain.proceed(chain.request())
                } finally {
                  firstConnectLatch.countDown()
                }
              },
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Nov 04 19:13:52 GMT 2025
    - 10.6K bytes
    - Click Count (0)
Back to Top