Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for writeTimeout (0.22 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/ConfigureTimeouts.java

    public final class ConfigureTimeouts {
      private final OkHttpClient client;
    
      public ConfigureTimeouts() throws Exception {
        client = new OkHttpClient.Builder()
            .connectTimeout(5, TimeUnit.SECONDS)
            .writeTimeout(5, TimeUnit.SECONDS)
            .readTimeout(5, TimeUnit.SECONDS)
            .callTimeout(10, TimeUnit.SECONDS)
            .build();
      }
    
      public void run() throws Exception {
        Request request = new Request.Builder()
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Sep 28 18:00:26 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt

         * The write timeout is applied for individual write IO operations. The default value is 10
         * seconds.
         *
         * @see Sink.timeout
         */
        fun writeTimeout(
          timeout: Long,
          unit: TimeUnit,
        ) = apply {
          writeTimeout = checkDuration("timeout", timeout, unit)
        }
    
        /**
         * Sets the default write timeout for new connections. A value of 0 means no timeout, otherwise
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:21:33 GMT 2024
    - 52K bytes
    - Viewed (0)
  3. okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt

          require(trailers.size != 0) { "trailers.size() == 0" }
          this.sink.trailers = trailers
        }
      }
    
      fun readTimeout(): Timeout = readTimeout
    
      fun writeTimeout(): Timeout = writeTimeout
    
      /** Returns a source that reads data from the peer. */
      fun getSource(): Source = source
    
      /**
       * Returns a sink that can be used to write data to the peer.
       *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 23.2K bytes
    - Viewed (1)
  4. okhttp/src/main/kotlin/okhttp3/internal/http/RealInterceptorChain.kt

        timeout: Int,
        unit: TimeUnit,
      ): Interceptor.Chain {
        check(exchange == null) { "Timeouts can't be adjusted in a network interceptor" }
    
        return copy(writeTimeoutMillis = checkDuration("writeTimeout", timeout.toLong(), unit))
      }
    
      override fun call(): Call = call
    
      override fun request(): Request = request
    
      @Throws(IOException::class)
      override fun proceed(request: Request): Response {
    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 (0)
  5. samples/guide/src/main/java/okhttp3/recipes/kt/ConfigureTimeouts.kt

    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class ConfigureTimeouts {
      private val client: OkHttpClient =
        OkHttpClient.Builder()
          .connectTimeout(5, TimeUnit.SECONDS)
          .writeTimeout(5, TimeUnit.SECONDS)
          .readTimeout(5, TimeUnit.SECONDS)
          .callTimeout(10, TimeUnit.SECONDS)
          .build()
    
      fun run() {
        val request =
          Request.Builder()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.3K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/OkHttpClientTest.kt

        } catch (ignored: IllegalArgumentException) {
        }
        try {
          builder.connectTimeout(Duration.ofNanos(1))
        } catch (ignored: IllegalArgumentException) {
        }
        try {
          builder.writeTimeout(Duration.ofNanos(1))
        } catch (ignored: IllegalArgumentException) {
        }
        try {
          builder.readTimeout(Duration.ofNanos(1))
        } catch (ignored: IllegalArgumentException) {
        }
        try {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.kt

      private val clientListener = WebSocketRecorder("client")
      private val serverListener = WebSocketRecorder("server")
      private val random = Random(0)
      private var client =
        clientTestRule.newClientBuilder()
          .writeTimeout(Duration.ofMillis(500))
          .readTimeout(Duration.ofMillis(500))
          .addInterceptor(
            Interceptor { chain: Interceptor.Chain ->
              val response = chain.proceed(chain.request())
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 35.2K bytes
    - Viewed (1)
  8. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

                  socket.receiveBufferSize = socketBufferSize
                  socket.sendBufferSize = socketBufferSize
                  return socket
                }
              },
            )
            .writeTimeout(Duration.ofMillis(500))
            .build()
        server.start()
        server.enqueue(
          MockResponse.Builder()
            .throttleBody(1, 1, TimeUnit.SECONDS)
            .build(),
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 131.7K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

        builder = builder.connectTimeout(Duration.ofSeconds(0L))
        builder = builder.readTimeout(0L, TimeUnit.SECONDS)
        builder = builder.readTimeout(Duration.ofSeconds(0L))
        builder = builder.writeTimeout(0L, TimeUnit.SECONDS)
        builder = builder.writeTimeout(Duration.ofSeconds(0L))
        builder = builder.pingInterval(0L, TimeUnit.SECONDS)
        builder = builder.pingInterval(Duration.ofSeconds(0L))
        builder = builder.proxy(Proxy.NO_PROXY)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 46.5K bytes
    - Viewed (4)
  10. okhttp/src/test/java/okhttp3/InterceptorTest.kt

          Interceptor { chain: Interceptor.Chain ->
            assertThat(chain.writeTimeoutMillis()).isEqualTo(100)
            chain.proceed(chain.request())
          }
        client =
          client.newBuilder()
            .writeTimeout(Duration.ofSeconds(5))
            .addInterceptor(interceptor1)
            .addInterceptor(interceptor2)
            .build()
        server.enqueue(
          MockResponse.Builder()
            .body("abc")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 27.8K bytes
    - Viewed (0)
Back to top