Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 5 of 5 for throttleBody (0.07 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. okhttp/src/jvmTest/kotlin/okhttp3/internal/http/ThreadInterruptTest.kt

      @Test
      fun interruptReadingResponseBody() {
        val responseBodySize = 8 * 1024 * 1024 // 8 MiB.
        server.enqueue(
          MockResponse()
            .setBody(Buffer().write(ByteArray(responseBodySize)))
            .throttleBody((64 * 1024).toLong(), 125, TimeUnit.MILLISECONDS),
        ) // 500 Kbps
        server.start()
        val call =
          client.newCall(
            Request
              .Builder()
              .url(server.url("/"))
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 18:33:48 GMT 2025
    - 6.4K bytes
    - Click Count (0)
  2. okhttp/src/jvmTest/kotlin/okhttp3/internal/http/CancelTest.kt

        val responseBodySize = 8 * 1024 * 1024 // 8 MiB.
        server.enqueue(
          MockResponse
            .Builder()
            .body(
              Buffer()
                .write(ByteArray(responseBodySize)),
            ).throttleBody(64 * 1024, 125, MILLISECONDS) // 500 Kbps
            .build(),
        )
        val call = client.newCall(Request(server.url("/")))
        val response = call.execute()
        cancelLater(call, 500)
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 19:13:52 GMT 2025
    - 9.4K bytes
    - Click Count (0)
  3. mockwebserver/README.md

    testing timeouts and interactive testing.
    
    ### Java
    ```java
    MockResponse response = new MockResponse.Builder()
        .throttleBody(1024, 1, TimeUnit.SECONDS)
        .build();
    ```
    
    ### Kotlin
    ```kotlin
    val response = MockResponse.Builder()
      .throttleBody(1024, 1, TimeUnit.SECONDS)
      .build()
    ```
    
    #### RecordedRequest
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Thu Oct 30 21:39:59 GMT 2025
    - 8.1K bytes
    - Click Count (0)
  4. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/DeprecationBridge.kt

        SocketPolicy.NO_RESPONSE -> result.onResponseStart(SocketEffect.Stall)
        SocketPolicy.RESET_STREAM_AT_START -> result.onRequestStart(CloseStream(http2ErrorCode))
      }
    
      result.throttleBody(throttleBytesPerPeriod, getThrottlePeriod(MILLISECONDS), MILLISECONDS)
      result.bodyDelay(getBodyDelay(MILLISECONDS), MILLISECONDS)
      result.headersDelay(getHeadersDelay(MILLISECONDS), MILLISECONDS)
      return result.build()
    }
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Thu Jul 03 13:16:34 GMT 2025
    - 4.1K bytes
    - Click Count (1)
  5. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/MockResponse.kt

      )
      fun getHttp2ErrorCode(): Int = http2ErrorCode
    
      fun setHttp2ErrorCode(http2ErrorCode: Int) =
        apply {
          this.http2ErrorCode = http2ErrorCode
        }
    
      fun throttleBody(
        bytesPerPeriod: Long,
        period: Long,
        unit: TimeUnit,
      ) = apply {
        throttleBytesPerPeriod = bytesPerPeriod
        throttlePeriodAmount = period
        throttlePeriodUnit = unit
      }
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat May 10 11:15:14 GMT 2025
    - 7.1K bytes
    - Click Count (1)
Back to Top