Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 27 for Delay (0.15 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/ConfigureTimeouts.java

            .callTimeout(10, TimeUnit.SECONDS)
            .build();
      }
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay.
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          System.out.println("Response completed: " + response);
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Sep 28 18:00:26 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  2. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

        }
    
        /**
         * Set the delayed time of the response body to [delay]. This applies to the response body
         * only; response headers are not affected.
         */
        fun bodyDelay(
          delay: Long,
          unit: TimeUnit,
        ) = apply {
          bodyDelayNanos = unit.toNanos(delay)
        }
    
        fun headersDelay(
          delay: Long,
          unit: TimeUnit,
        ) = apply {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 13.3K bytes
    - Viewed (1)
  3. okhttp/src/main/kotlin/okhttp3/internal/concurrent/Task.kt

     * task should not be executed again. Otherwise it returns a delay until the next execution.
     *
     * A task has at most one next execution. If the same task instance is scheduled multiple times, the
     * earliest one wins. This applies to both executions scheduled with [TaskRunner.Queue.schedule] and
     * those implied by the returned execution delay.
     *
     * Cancellation
     * ------------
     *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.4K bytes
    - Viewed (0)
  4. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/MockResponse.kt

      fun setBodyDelay(
        delay: Long,
        unit: TimeUnit,
      ) = apply {
        bodyDelayAmount = delay
        bodyDelayUnit = unit
      }
    
      fun getBodyDelay(unit: TimeUnit): Long = unit.convert(bodyDelayAmount, bodyDelayUnit)
    
      fun setHeadersDelay(
        delay: Long,
        unit: TimeUnit,
      ) = apply {
        headersDelayAmount = delay
        headersDelayUnit = unit
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  5. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

      }
    
      /**
       * Throttle the request body by sleeping 500ms after every 3 bytes. With a 6-byte request, this
       * should yield one sleep for a total delay of 500ms.
       */
      @Test
      fun throttleRequest() {
        assumeNotWindows()
        server.enqueue(
          MockResponse()
            .throttleBody(3, 500, TimeUnit.MILLISECONDS),
        )
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 21.9K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/ConfigureTimeouts.kt

          .readTimeout(5, TimeUnit.SECONDS)
          .callTimeout(10, TimeUnit.SECONDS)
          .build()
    
      fun run() {
        val request =
          Request.Builder()
            .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay.
            .build()
    
        client.newCall(request).execute().use { response ->
          println("Response completed: $response")
        }
      }
    }
    
    fun main() {
      ConfigureTimeouts().run()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.3K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/CancelCall.java

      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay.
            .build();
    
        final long startNanos = System.nanoTime();
        final Call call = client.newCall(request);
    
        // Schedule a job to cancel the call in 1 second.
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.1K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/PerCallSettings.java

      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://httpbin.org/delay/1") // This URL is served with a 1 second delay.
            .build();
    
        // Copy to customize OkHttp for this request.
        OkHttpClient client1 = client.newBuilder()
            .readTimeout(500, TimeUnit.MILLISECONDS)
            .build();
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.9K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/DuplexTest.kt

        server.useHttps(handshakeCertificates.sslSocketFactory())
      }
    
      private inner class DelayedRequestBody(
        private val delegate: RequestBody,
        delay: Long,
        timeUnit: TimeUnit,
      ) : RequestBody() {
        private val delayMillis = timeUnit.toMillis(delay)
    
        override fun contentType() = delegate.contentType()
    
        override fun isDuplex() = true
    
        override fun writeTo(sink: BufferedSink) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 23.9K bytes
    - Viewed (0)
  10. okhttp-testing-support/src/main/kotlin/okhttp3/OkHttpClientTestRule.kt

            // Minimise test flakiness due to possible race conditions with connections closing.
            // Some number of tests will report here, but not fail due to this delay.
            println("Delaying to avoid flakes")
            Thread.sleep(500L)
            println("After delay: " + connectionPool.connectionCount())
          }
    
          connectionPool.evictAll()
          assertEquals(0, connectionPool.connectionCount()) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.5K bytes
    - Viewed (0)
Back to top