Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for newBuilder (0.23 sec)

  1. okhttp/src/test/java/okhttp3/ConnectionListenerTest.kt

      }
    
      @Test
      fun failedCallEventSequence() {
        server!!.enqueue(
          MockResponse.Builder()
            .headersDelay(2, TimeUnit.SECONDS)
            .build(),
        )
        client =
          client.newBuilder()
            .readTimeout(Duration.ofMillis(250))
            .build()
        val call =
          client.newCall(
            Request.Builder()
              .url(server!!.url("/"))
              .build(),
          )
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/CallKotlinTest.kt

            "CN=localhost",
            (response.handshake!!.peerCertificates.single() as X509Certificate).subjectDN.name,
          )
        }
      }
    
      private fun enableTls() {
        client =
          client.newBuilder()
            .sslSocketFactory(
              handshakeCertificates.sslSocketFactory(),
              handshakeCertificates.trustManager,
            )
            .build()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  3. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/MockResponse.kt

      @set:JvmName("headers")
      var headers: Headers
        get() = headersBuilder.build()
        set(value) {
          this.headersBuilder = value.newBuilder()
        }
    
      @set:JvmName("trailers")
      var trailers: Headers
        get() = trailersBuilder.build()
        set(value) {
          this.trailersBuilder = value.newBuilder()
        }
    
      private var body: Buffer? = null
    
      var throttleBytesPerPeriod: Long = Long.MAX_VALUE
        private set
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/internal/http/BridgeInterceptor.kt

      @Throws(IOException::class)
      override fun intercept(chain: Interceptor.Chain): Response {
        val userRequest = chain.request()
        val requestBuilder = userRequest.newBuilder()
    
        val body = userRequest.body
        if (body != null) {
          val contentType = body.contentType()
          if (contentType != null) {
            requestBuilder.header("Content-Type", contentType.toString())
          }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (2)
  5. samples/guide/src/main/java/okhttp3/recipes/kt/PerCallSettings.kt

          Request.Builder()
            .url("http://httpbin.org/delay/1") // This URL is served with a 1 second delay.
            .build()
    
        // Copy to customize OkHttp for this request.
        val client1 =
          client.newBuilder()
            .readTimeout(500, TimeUnit.MILLISECONDS)
            .build()
        try {
          client1.newCall(request).execute().use { response ->
            println("Response 1 succeeded: $response")
          }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/Authenticator.kt

     * for (Challenge challenge : response.challenges()) {
     *   // If this is preemptive auth, use a preemptive credential.
     *   if (challenge.scheme().equalsIgnoreCase("OkHttp-Preemptive")) {
     *     return response.request().newBuilder()
     *         .header("Proxy-Authorization", "secret")
     *         .build();
     *   }
     * }
     * return null; // Didn't find a preemptive auth scheme.
     * ```
     *
     * ## Reactive Authentication
     *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  7. samples/compare/src/test/kotlin/okhttp3/compare/JavaHttpClientTest.kt

        platform.expectFailureOnJdkVersion(8)
    
        val httpClient =
          HttpClient.newBuilder()
            .followRedirects(NORMAL)
            .build()
    
        server.enqueue(
          MockResponse.Builder()
            .body("hello, Java HTTP Client")
            .build(),
        )
    
        val request =
          HttpRequest.newBuilder(server.url("/").toUri())
            .header("Accept", "text/plain")
            .build()
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  8. android-test/src/androidTest/java/okhttp/android/test/sni/SniOverrideTest.kt

              sslSocket.sslParameters = parameters
            }
    
            return sslSocket
          }
        }
    
        client =
          client.newBuilder()
            .sslSocketFactory(CustomSSLSocketFactory(client.sslSocketFactory), client.x509TrustManager!!)
            .hostnameVerifier { hostname, session ->
              val s = "hostname: $hostname peerHost:${session.peerHost}"
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt

      }
    
      private fun enableProtocol(protocol: Protocol) {
        enableTls()
        client =
          client.newBuilder()
            .protocols(listOf(protocol, Protocol.HTTP_1_1))
            .build()
        server.protocols = client.protocols
      }
    
      private fun enableTls() {
        client =
          client.newBuilder()
            .sslSocketFactory(
              handshakeCertificates.sslSocketFactory(),
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  10. mockwebserver/src/test/java/mockwebserver3/MockResponseSniTest.kt

              handshakeCertificates.sslSocketFactory(),
              handshakeCertificates.trustManager,
            )
            .dns(dns)
            .build()
    
        server.enqueue(MockResponse())
    
        val url = server.url("/").newBuilder().host("localhost.localdomain").build()
        val call = client.newCall(Request(url = url))
        val response = call.execute()
        assertThat(response.isSuccessful).isTrue()
    
        val recordedRequest = server.takeRequest()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.9K bytes
    - Viewed (1)
Back to top