Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for sleep (0.13 sec)

  1. okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.kt

        val relay = edit(file, pipe.source, metadata, 5)
        val future1 = executor.submit(sourceReader(relay.newSource()))
        val future2 = executor.submit(sourceReader(relay.newSource()))
        Thread.sleep(500)
        sink.writeUtf8("abcdefghij")
        Thread.sleep(500)
        sink.writeUtf8("klmnopqrst")
        sink.close()
        assertThat<ByteString>(future1.get())
          .isEqualTo("abcdefghijklmnopqrst".encodeUtf8())
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.kt

            .build(),
        )
        val webSocket: WebSocket = newWebSocket()
        clientListener.assertOpen()
        val server = serverListener.assertOpen()
    
        // Sleep longer than the HTTP client's read timeout.
        Thread.sleep((client.readTimeoutMillis + 500).toLong())
        server.send("abc")
        clientListener.assertTextMessage("abc")
        closeWebSockets(webSocket, server)
      }
    
      @Test
    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)
  3. okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsOverHttpsTest.kt

        assertThat(recordedRequest!!.method).isEqualTo("GET")
        assertThat(recordedRequest.path).isEqualTo(
          "/lookup?ct&dns=AAABAAABAAAAAAAABmdvb2dsZQNjb20AAAEAAQ",
        )
        Thread.sleep(2000)
        server.enqueue(
          dnsResponse(
            "0000818000010003000000000567726170680866616365626f6f6b03636f6d0000010001c00c000500010" +
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 11K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/FakeRoutePlanner.kt

            }
        }
    
        override fun connectTcp(): ConnectResult {
          check(connectState == ConnectState.READY)
          events += "plan $id TCP connecting..."
    
          taskFaker.sleep(tcpConnectDelayNanos)
    
          if (yieldBeforeTcpConnectReturns) {
            taskFaker.yield()
          }
    
          return when {
            tcpConnectThrowable != null -> {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 24 04:40:49 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  5. okhttp-testing-support/src/main/kotlin/okhttp3/internal/concurrent/TaskFaker.kt

          yieldUntil(ResumePriority.BeforeOtherTasks) {
            contextSwitchCount > contextSwitchCountBefore
          }
        }
      }
    
      /** Sleep until [durationNanos] elapses. For use by the task threads. */
      fun sleep(durationNanos: Long) {
        taskRunner.lock.withLock {
          val sleepUntil = nanoTime + durationNanos
          yieldUntil { nanoTime >= sleepUntil }
        }
      }
    
      /**
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 29 00:33:04 GMT 2024
    - 12.6K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/internal/connection/ConnectionPoolTest.kt

        assertThat(realTaskRunner.activeQueues()).isNotEmpty()
        Thread.sleep(100)
        val threads = arrayOfNulls<Thread>(Thread.activeCount() * 2)
        Thread.enumerate(threads)
        for (t in threads) {
          if (t != null && t.name == "OkHttp TaskRunner") {
            t.interrupt()
          }
        }
        Thread.sleep(100)
        assertThat(realTaskRunner.activeQueues()).isEmpty()
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 24 04:40:49 GMT 2024
    - 12.7K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/CallTest.kt

        val request1ReceivedAt = System.currentTimeMillis()
        assertThat(server.takeRequest().headers["If-None-Match"]).isNull()
    
        // Hit that stored response. It's different, but Vary says it doesn't matter.
        Thread.sleep(10) // Make sure the timestamps are unique.
        val cacheHit =
          executeSynchronously(
            "/",
            "Accept-Language",
            "en-US",
            "Accept-Charset",
            "UTF-8",
          )
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 142.5K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/internal/concurrent/TaskRunner.kt

          var readyTask: Task? = null
          var multipleReadyTasks = false
    
          // Decide what to run. This loop's goal wants to:
          //  * Find out what this thread should do (either run a task or sleep)
          //  * Find out if there's enough work to start another thread.
          eachQueue@ for (queue in readyQueues) {
            val candidate = queue.futureTasks[0]
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 29 00:33:04 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/TestUtilJvm.kt

       * java/lang/ref/FinalizationTester.java
       */
      @Throws(Exception::class)
      @JvmStatic
      fun awaitGarbageCollection() {
        Runtime.getRuntime().gc()
        Thread.sleep(100)
        System.runFinalization()
      }
    
      @JvmStatic
      fun assumeNetwork() {
        try {
          InetAddress.getByName("www.google.com")
        } catch (uhe: UnknownHostException) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.kt

      private fun waitForConnectionShutdown(connection: RealConnection?) {
        if (connection!!.isHealthy(false)) {
          Thread.sleep(100L)
        }
        if (connection.isHealthy(false)) {
          Thread.sleep(2000L)
        }
        if (connection.isHealthy(false)) {
          throw TimeoutException("connection didn't shutdown within timeout")
        }
      }
    
      /**
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 75.3K bytes
    - Viewed (0)
Back to top