Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 13 for throttleBody (0.05 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-deprecated/src/test/java/okhttp3/mockwebserver/KotlinSourceModernTest.kt

        mockResponse.socketPolicy = SocketPolicy.KEEP_OPEN
        var http2ErrorCode: Int = mockResponse.http2ErrorCode
        mockResponse.http2ErrorCode = 0
        mockResponse = mockResponse.throttleBody(0L, 0L, TimeUnit.SECONDS)
        var throttleBytesPerPeriod: Long = mockResponse.throttleBytesPerPeriod
        throttleBytesPerPeriod = mockResponse.throttleBytesPerPeriod
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.3K bytes
    - Click Count (0)
  4. 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)
  5. 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 Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 16:11:23 GMT 2025
    - 28.2K bytes
    - Click Count (0)
  6. 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 Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat Nov 08 21:45:04 GMT 2025
    - 18.8K bytes
    - Click Count (0)
  7. mockwebserver/api/mockwebserver3.api

    	public final fun socketHandler (Lmockwebserver3/SocketHandler;)Lmockwebserver3/MockResponse$Builder;
    	public final fun status (Ljava/lang/String;)Lmockwebserver3/MockResponse$Builder;
    	public final fun throttleBody (JJLjava/util/concurrent/TimeUnit;)Lmockwebserver3/MockResponse$Builder;
    	public final fun trailers (Lokhttp3/Headers;)Lmockwebserver3/MockResponse$Builder;
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Jun 20 11:46:46 GMT 2025
    - 11.8K bytes
    - Click Count (0)
  8. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

        /**
         * Throttles the request reader and response writer to sleep for the given period after each
         * series of [bytesPerPeriod] bytes are transferred. Use this to simulate network behavior.
         */
        public fun throttleBody(
          bytesPerPeriod: Long,
          period: Long,
          unit: TimeUnit,
        ): Builder =
          apply {
            throttleBytesPerPeriod = bytesPerPeriod
            throttlePeriodNanos = unit.toNanos(period)
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Jun 20 11:46:46 GMT 2025
    - 17.8K bytes
    - Click Count (0)
  9. 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 Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Nov 05 18:28:35 GMT 2025
    - 70.5K bytes
    - Click Count (0)
  10. okhttp/src/jvmTest/kotlin/okhttp3/KotlinSourceModernTest.kt

        mockResponse.socketPolicy = SocketPolicy.KEEP_OPEN
        var http2ErrorCode: Int = mockResponse.http2ErrorCode
        mockResponse.http2ErrorCode = 0
        mockResponse = mockResponse.throttleBody(0L, 0L, TimeUnit.SECONDS)
        var throttleBytesPerPeriod: Long = mockResponse.throttleBytesPerPeriod
        throttleBytesPerPeriod = mockResponse.throttleBytesPerPeriod
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Nov 05 18:28:35 GMT 2025
    - 47K bytes
    - Click Count (0)
Back to Top