Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for Nanoseconds (0.3 sec)

  1. 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()
    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)
  2. okhttp-testing-support/src/main/kotlin/okhttp3/RecordingConnectionListener.kt

        lastTimestampNs = result.timestampNs
    
        if (eventClass != null) {
          assertThat(result).isInstanceOf(eventClass)
        }
    
        if (elapsedMs != -1L) {
          assertThat(
            TimeUnit.NANOSECONDS.toMillis(actualElapsedNs)
              .toDouble(),
          )
            .isCloseTo(elapsedMs.toDouble(), 100.0)
        }
    
        return result
      }
    
      fun recordedEventTypes() = eventSequence.map { it.name }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  3. 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)
  4. okhttp/src/test/java/okhttp3/internal/UtilTest.kt

    import java.net.InetAddress
    import java.net.ServerSocket
    import java.net.Socket
    import java.util.concurrent.TimeUnit
    import kotlin.time.Duration.Companion.milliseconds
    import kotlin.time.Duration.Companion.nanoseconds
    import okio.buffer
    import okio.source
    import org.junit.jupiter.api.Test
    import org.junit.jupiter.api.assertThrows
    
    class UtilTest {
      @Test
      fun socketIsHealthy() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3K bytes
    - Viewed (0)
  5. 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)
  6. okhttp/src/main/kotlin/okhttp3/internal/concurrent/Task.kt

    ) {
      // Guarded by the TaskRunner.
      internal var queue: TaskQueue? = null
    
      /** Undefined unless this is in [TaskQueue.futureTasks]. */
      internal var nextExecuteNanoTime = -1L
    
      /** Returns the delay in nanoseconds until the next execution, or -1L to not reschedule. */
      abstract fun runOnce(): Long
    
      internal fun initQueue(queue: TaskQueue) {
        if (this.queue === queue) return
    
    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)
  7. okhttp-testing-support/src/main/kotlin/okhttp3/ClientRuleEventListener.kt

        val startNs = startNs
        val timeMs =
          if (startNs == null) {
            // Event occurred before start, for an example an early cancel.
            0L
          } else {
            TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
          }
    
        logger.invoke("[$timeMs ms] $message")
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 6K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/internal/connection/FastFallbackExchangeFinder.kt

            }
    
            // Wait for an in-flight connect to complete or fail.
            if (connectResult == null) {
              connectResult = awaitTcpConnect(awaitTimeoutNanos, TimeUnit.NANOSECONDS) ?: continue
            }
    
            if (connectResult.isSuccess) {
              // We have a connected TCP connection. Cancel and defer the racing connects that all lost.
              cancelInFlightConnects()
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/TestValueFactory.kt

      ): RealConnectionPool {
        return RealConnectionPool(
          taskRunner = taskRunner,
          maxIdleConnections = maxIdleConnections,
          keepAliveDuration = 100L,
          timeUnit = TimeUnit.NANOSECONDS,
          connectionListener = ConnectionListener.NONE,
          exchangeFinderFactory = { pool, address, user ->
            FastFallbackExchangeFinder(
              routePlanner ?: RealRoutePlanner(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  10. 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)
Back to top