Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 23 for toMillis (0.23 sec)

  1. okhttp/src/test/java/okhttp3/RecordingCallback.kt

        val timeoutMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) + TIMEOUT_MILLIS
        while (true) {
          val i = responses.iterator()
          while (i.hasNext()) {
            val recordedResponse = i.next()
            if (recordedResponse.request.url.equals(url)) {
              i.remove()
              return recordedResponse
            }
          }
          val nowMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime())
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/internal/cache/CacheStrategy.kt

          if (requestCaching.maxAgeSeconds != -1) {
            freshMillis = minOf(freshMillis, SECONDS.toMillis(requestCaching.maxAgeSeconds.toLong()))
          }
    
          var minFreshMillis: Long = 0
          if (requestCaching.minFreshSeconds != -1) {
            minFreshMillis = SECONDS.toMillis(requestCaching.minFreshSeconds.toLong())
          }
    
          var maxStaleMillis: Long = 0
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 12K bytes
    - Viewed (0)
  3. mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt

        val inputStream = connection.getInputStream()
        assertThat(inputStream.read()).isEqualTo(-1)
        val elapsedNanos = System.nanoTime() - startNanos
        val elapsedMillis = TimeUnit.NANOSECONDS.toMillis(elapsedNanos)
        assertThat(elapsedMillis).isBetween(500L, 1000L)
      }
    
      /**
       * Throttle the response body by sleeping 500ms after every 3 bytes. With a 6-byte response, this
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 23.5K bytes
    - Viewed (0)
  4. mockwebserver/src/main/kotlin/mockwebserver3/internal/duplex/MockStreamHandler.kt

      fun exhaustResponse() =
        apply {
          actions += { stream -> stream.responseBody.close() }
        }
    
      fun sleep(
        duration: Long,
        unit: TimeUnit,
      ) = apply {
        actions += { Thread.sleep(unit.toMillis(duration)) }
      }
    
      override fun handle(stream: Stream) {
        val task = serviceStreamTask(stream)
        results.add(task)
        task.run()
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  5. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

          try {
            response = chain.proceed(request)
          } catch (e: Exception) {
            logger.log("<-- HTTP FAILED: $e")
            throw e
          }
    
          val tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
    
          val responseBody = response.body!!
          val contentLength = responseBody.contentLength()
          val bodySize = if (contentLength != -1L) "$contentLength-byte" else "unknown-length"
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  6. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

        val inputStream = connection.getInputStream()
        assertThat(inputStream.read()).isEqualTo(-1)
        val elapsedNanos = System.nanoTime() - startNanos
        val elapsedMillis = TimeUnit.NANOSECONDS.toMillis(elapsedNanos)
        assertThat(elapsedMillis).isBetween(500L, 1000L)
      }
    
      /**
       * Throttle the response body by sleeping 500ms after every 3 bytes. With a 6-byte response, this
    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)
  7. okhttp/src/test/java/okhttp3/CacheCorruptionTest.kt

       *     positive values yield dates in the future.
       */
      private fun formatDate(
        delta: Long,
        timeUnit: TimeUnit,
      ): String? {
        return formatDate(Date(System.currentTimeMillis() + timeUnit.toMillis(delta)))
      }
    
      private fun formatDate(date: Date): String? {
        val rfc1123: DateFormat = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US)
        rfc1123.timeZone = TimeZone.getTimeZone("GMT")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 6K bytes
    - Viewed (1)
  8. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/LoggingEventListener.kt

        call: Call,
        cachedResponse: Response,
      ) {
        logWithTime("cacheConditionalHit: $cachedResponse")
      }
    
      private fun logWithTime(message: String) {
        val timeMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
        logger.log("[$timeMs ms] $message")
      }
    
      open class Factory
        @JvmOverloads
        constructor(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 11:07:32 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt

         * The default value is 0 which imposes no timeout.
         */
        @SuppressLint("NewApi")
        @IgnoreJRERequirement
        fun callTimeout(duration: Duration) =
          apply {
            callTimeout(duration.toMillis(), MILLISECONDS)
          }
    
        /**
         * Sets the default timeout for complete calls. A value of 0 means no timeout, otherwise values
         * must be between 1 and [Integer.MAX_VALUE] when converted to milliseconds.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:21:33 GMT 2024
    - 52K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.kt

        val startNanos = System.nanoTime()
        while (webSocket.receivedPongCount() < 3) {
          Thread.sleep(50)
        }
        val elapsedUntilPong3 = System.nanoTime() - startNanos
        assertThat(TimeUnit.NANOSECONDS.toMillis(elapsedUntilPong3).toDouble())
          .isCloseTo(1500.0, 250.0)
    
        // The client pinged the server 3 times, and it has ponged back 3 times.
        assertThat(webSocket.sentPingCount()).isEqualTo(3)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 35.2K bytes
    - Viewed (1)
Back to top