- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 18 for throttleBody (0.21 sec)
-
okhttp/src/test/java/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)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 20 10:30:28 UTC 2024 - 9.9K bytes - Viewed (0) -
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
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 7.3K bytes - Viewed (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 }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 7.2K bytes - Viewed (0) -
okhttp/src/test/java/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("/")) .build(),
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 4.6K bytes - Viewed (0) -
mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/DeprecationBridge.kt
result.add100Continue() KeepOpen } SocketPolicy.UPGRADE_TO_SSL_AT_END -> { result.inTunnel() KeepOpen } else -> wrapSocketPolicy() } result.throttleBody(throttleBytesPerPeriod, getThrottlePeriod(MILLISECONDS), MILLISECONDS) result.bodyDelay(getBodyDelay(MILLISECONDS), MILLISECONDS) result.headersDelay(getHeadersDelay(MILLISECONDS), MILLISECONDS) return result.build() }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 4.6K bytes - Viewed (0) -
mockwebserver/README.md
.addHeader("Cache-Control", "no-cache") .setBody("{}"); ``` MockResponse can be used to simulate a slow network. This is useful for testing timeouts and interactive testing. ```java response.throttleBody(1024, 1, TimeUnit.SECONDS); ``` #### RecordedRequest Verify requests by their method, path, HTTP version, body, and headers. ```java RecordedRequest request = server.takeRequest();
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Dec 17 15:34:10 UTC 2023 - 5K bytes - Viewed (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. */ fun throttleBody( bytesPerPeriod: Long, period: Long, unit: TimeUnit, ) = apply { throttleBytesPerPeriod = bytesPerPeriod throttlePeriodNanos = unit.toNanos(period) } /**
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Tue Jan 23 14:31:42 UTC 2024 - 13.3K bytes - Viewed (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)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 21.9K bytes - Viewed (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
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 23.5K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/InterceptorTest.kt
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Jan 14 10:20:09 UTC 2024 - 27.8K bytes - Viewed (0)