Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 34 for Sleep (0.15 sec)

  1. mockwebserver/src/main/kotlin/mockwebserver3/internal/SleepNanos.kt

     *
     */
    package mockwebserver3.internal
    
    internal fun sleepNanos(nanos: Long) {
      val ms = nanos / 1_000_000L
      val ns = nanos - (ms * 1_000_000L)
      if (ms > 0L || nanos > 0) {
        Thread.sleep(ms, ns.toInt())
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 07 16:05:34 GMT 2024
    - 811 bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt

        override fun contentType(): MediaType? = null
    
        override fun writeTo(sink: BufferedSink) {
          for (i in 0 until 50) {
            sink.writeUtf8("abc")
            sink.flush()
            Thread.sleep(100)
          }
          fail("")
        }
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

        assertThat(server.takeRequest().sequenceNumber).isEqualTo(0)
    
        // Give the server time to enact the socket policy if it's one that could happen after the
        // client has received the response.
        Thread.sleep(500)
        val response2 = getResponse(newRequest("/b"))
        response1.body.source().timeout().timeout(100, TimeUnit.MILLISECONDS)
        assertContent("This comes after a busted connection", response2)
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 131.7K bytes
    - Viewed (0)
  4. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

       * response is ready.
       */
      @Test
      fun dispatchBlocksWaitingForEnqueue() {
        Thread {
          try {
            Thread.sleep(1000)
          } catch (ignored: InterruptedException) {
          }
          server.enqueue(MockResponse().setBody("enqueued in the background"))
        }.start()
        val connection = server.url("/").toUrl().openConnection()
    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)
  5. 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)
  6. okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.kt

          Request.Builder()
            .url(server.url("/"))
            .build()
        val call = client.newCall(request)
        call.timeout().timeout(250, TimeUnit.MILLISECONDS)
        val response = call.execute()
        Thread.sleep(500)
        assertFailsWith<IOException> {
          response.body.source().readUtf8()
        }.also { expected ->
          assertThat(expected.message).isEqualTo("timeout")
          assertThat(call.isCanceled()).isTrue()
        }
    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)
  7. okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.kt

        responseBody.close()
      }
    
      private fun sleep(delayMillis: Int) {
        try {
          Thread.sleep(delayMillis.toLong())
        } catch (e: InterruptedException) {
          Thread.currentThread().interrupt()
        }
      }
    
      private fun interruptLater(delayMillis: Int) {
        val toInterrupt = Thread.currentThread()
        val interruptingCow =
          Thread {
            sleep(delayMillis)
            toInterrupt.interrupt()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/kt/WiresharkExample.kt

        try {
          for (i in 1..2) {
            // Space out traffic to make it easier to demarcate.
            sendTestRequest(fbRequest)
            Thread.sleep(1000)
            sendTestRequest(twitterRequest)
            Thread.sleep(1000)
            sendTestRequest(googleRequest)
            Thread.sleep(2000)
          }
        } finally {
          client.connectionPool.evictAll()
          client.dispatcher.executorService.shutdownNow()
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.7K bytes
    - Viewed (1)
  9. fuzzing/fuzzingserver-test.sh

      exit 1
    fi
    which jq
    if [ $? != 0 ]; then
      echo "Run 'brew install jq'"
      exit 1
    fi
    
    trap 'kill $(jobs -pr)' SIGINT SIGTERM EXIT
    
    set -ex
    
    wstest -m fuzzingserver -s fuzzingserver-config.json &
    sleep 2 # wait for wstest to start
    
    java -jar target/okhttp-tests-*-jar-with-dependencies.jar
    
    jq '.[] as $in | $in | keys[] | . + " " + $in[.].behavior' target/fuzzingserver-report/index.json > target/fuzzingserver-actual.txt
    
    Shell Script
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Mar 26 02:01:32 GMT 2019
    - 673 bytes
    - Viewed (0)
  10. mockwebserver/src/main/kotlin/mockwebserver3/internal/duplex/MockStreamHandler.kt

          responseSent.countDown()
        }
      }
    
      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)
Back to top