Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 12 for throttleBody (0.07 seconds)

  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 Apr 03 11:42:14 GMT 2026
    - 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 Apr 03 11:42:14 GMT 2026
    - 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 Apr 03 11:42:14 GMT 2026
    - Last Modified: Thu Oct 30 21:39:59 GMT 2025
    - 8.1K bytes
    - Click Count (0)
  4. okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt

            .addInterceptor(interceptor1)
            .addInterceptor(interceptor2)
            .build()
        server.enqueue(
          MockResponse
            .Builder()
            .body("abc")
            .throttleBody(1, 1, TimeUnit.SECONDS)
            .build(),
        )
        val request1 =
          Request
            .Builder()
            .url(server.url("/"))
            .build()
        val call = client.newCall(request1)
    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)
  5. okhttp/src/jvmTest/kotlin/okhttp3/TrailersTest.kt

        server.enqueue(
          MockResponse
            .Builder()
            .addHeader("h1", "v1")
            .trailers(headersOf("t1", "v2"))
            .body(protocol, halfResponseBody + halfResponseBody)
            .throttleBody(
              OKHTTP_CLIENT_WINDOW_SIZE.toLong(),
              DISCARD_STREAM_TIMEOUT_MILLIS.toLong() + 1L,
              TimeUnit.MILLISECONDS,
            ).build(),
        )
    
        val call =
          client.newCall(
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Jan 27 09:00:39 GMT 2026
    - 18.8K bytes
    - Click Count (0)
  6. okhttp/src/jvmTest/kotlin/okhttp3/EventListenerTest.kt

        }
      }
    
      @Test
      fun failedDribbledCallEventSequence() {
        server.enqueue(
          MockResponse
            .Builder()
            .body("0123456789")
            .throttleBody(2, 100, TimeUnit.MILLISECONDS)
            .onResponseBody(CloseSocket())
            .build(),
        )
        client =
          client
            .newBuilder()
            .protocols(listOf<Protocol>(Protocol.HTTP_1_1))
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Feb 03 22:17:59 GMT 2026
    - 70.7K bytes
    - Click Count (0)
  7. okhttp/src/jvmTest/kotlin/okhttp3/internal/http2/HttpOverHttp2Test.kt

        val body = CharArray(4096) // 4KiB to read.
        Arrays.fill(body, 'y')
        server.enqueue(
          MockResponse
            .Builder()
            .body(String(body))
            .throttleBody(1024, 1, TimeUnit.SECONDS) // Slow connection 1KiB/second.
            .build(),
        )
        client =
          client
            .newBuilder()
            .readTimeout(Duration.ofSeconds(2))
            .build()
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Jan 27 09:00:39 GMT 2026
    - 67.5K bytes
    - Click Count (0)
  8. okhttp/src/jvmTest/kotlin/okhttp3/URLConnectionTest.kt

        assertThat(getResponse(Request(url)).code).isEqualTo(407)
      }
    
      @Test
      fun disconnectedConnection() {
        server.enqueue(
          MockResponse
            .Builder()
            .throttleBody(2, 100, TimeUnit.MILLISECONDS)
            .body("ABCD")
            .build(),
        )
        val call = client.newCall(newRequest("/"))
        val response = call.execute()
        val inputStream = response.body.byteStream()
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Jan 27 09:00:39 GMT 2026
    - 133.3K bytes
    - Click Count (0)
  9. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/DeprecationBridge.kt

          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 Apr 03 11:42:14 GMT 2026
    - Last Modified: Tue Jan 27 09:00:39 GMT 2026
    - 4.3K bytes
    - Click Count (1)
  10. okhttp/src/jvmTest/kotlin/okhttp3/CallTest.kt

      }
    
      @Test
      fun timeoutsUpdatedOnReusedConnections() {
        server.enqueue(MockResponse(body = "abc"))
        server.enqueue(
          MockResponse
            .Builder()
            .body("def")
            .throttleBody(1, 750, TimeUnit.MILLISECONDS)
            .build(),
        )
    
        // First request: time out after 1s.
        client =
          client
            .newBuilder()
            .readTimeout(Duration.ofSeconds(1))
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Sun Mar 15 09:02:18 GMT 2026
    - 146.5K bytes
    - Click Count (0)
Back to Top