- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 19 for throttleBody (0.07 seconds)
-
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: 2026-04-03 11:42 - Last Modified: 2025-11-04 18:33 - 6.4K bytes - Click Count (0) -
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: 2026-04-03 11:42 - Last Modified: 2025-11-04 19:13 - 9.4K bytes - Click Count (0) -
mockwebserver/README.md
Created: 2026-04-03 11:42 - Last Modified: 2025-10-30 21:39 - 8.1K bytes - Click Count (0) -
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: 2026-04-03 11:42 - Last Modified: 2025-05-10 11:15 - 7.1K bytes - Click Count (1) -
okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt
Created: 2026-04-03 11:42 - Last Modified: 2025-11-04 16:11 - 28.2K bytes - Click Count (0) -
mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt
* should yield one sleep for a total delay of 500ms. */ @Test fun throttleRequest() { assumeNotWindows() server.enqueue( MockResponse() .throttleBody(3, 500, TimeUnit.MILLISECONDS), ) val startNanos = System.nanoTime() val connection = server.url("/").toUrl().openConnection() connection.setDoOutput(true)
Created: 2026-04-03 11:42 - Last Modified: 2025-07-03 13:16 - 22.3K bytes - Click Count (0) -
mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt
* should yield one sleep for a total delay of 500ms. */ @Test fun throttleRequest() { assumeNotWindows() server.enqueue( MockResponse .Builder() .throttleBody(3, 500, TimeUnit.MILLISECONDS) .build(), ) val startNanos = System.nanoTime() val connection = server.url("/").toUrl().openConnection() connection.doOutput = true
Created: 2026-04-03 11:42 - Last Modified: 2025-08-03 22:38 - 28K bytes - Click Count (0) -
mockwebserver-deprecated/api/mockwebserver.api
public final fun setTrailers (Lokhttp3/Headers;)Lokhttp3/mockwebserver/MockResponse; public final fun socketPolicy (Lokhttp3/mockwebserver/SocketPolicy;)V public final fun status (Ljava/lang/String;)V public final fun throttleBody (JJLjava/util/concurrent/TimeUnit;)Lokhttp3/mockwebserver/MockResponse; public fun toString ()Ljava/lang/String; public final fun trailers (Lokhttp3/Headers;)V
Created: 2026-04-03 11:42 - Last Modified: 2023-07-22 12:28 - 10.2K bytes - Click Count (0) -
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: 2026-04-03 11:42 - Last Modified: 2026-01-27 09:00 - 18.8K bytes - Click Count (0) -
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: 2026-04-03 11:42 - Last Modified: 2025-06-20 11:46 - 17.8K bytes - Click Count (0)