Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for throttleBody (0.07 sec)

  1. 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)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 9.8K bytes
    - Viewed (0)
  2. 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)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 28.2K bytes
    - Viewed (0)
  3. 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)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 17.8K bytes
    - Viewed (0)
  4. 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 Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Jul 03 13:16:34 UTC 2025
    - 22.3K bytes
    - Viewed (0)
  5. 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;
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 11.8K bytes
    - Viewed (0)
  6. 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 Sep 05 11:42:10 UTC 2025
    - Last Modified: Sun Aug 03 22:38:00 UTC 2025
    - 28K bytes
    - Viewed (0)
  7. 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
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jul 22 12:28:51 UTC 2023
    - 10.2K bytes
    - Viewed (0)
  8. 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
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jun 21 20:36:35 UTC 2025
    - 46.5K bytes
    - Viewed (0)
Back to top