Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 323 for Enqueue (0.07 sec)

  1. okhttp/src/main/kotlin/okhttp3/internal/connection/RealCall.kt

          return getResponseWithInterceptorChain()
        } finally {
          client.dispatcher.finished(this)
        }
      }
    
      override fun enqueue(responseCallback: Callback) {
        check(executed.compareAndSet(false, true)) { "Already Executed" }
    
        callStart()
        client.dispatcher.enqueue(AsyncCall(responseCallback))
      }
    
      override fun isExecuted(): Boolean = executed.get()
    
      private fun callStart() {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Apr 20 17:03:43 UTC 2024
    - 17.9K bytes
    - Viewed (0)
  2. okhttp-coroutines/src/main/kotlin/okhttp3/coroutines/ExecuteAsync.kt

    @ExperimentalCoroutinesApi // resume with a resource cleanup.
    suspend fun Call.executeAsync(): Response =
      suspendCancellableCoroutine { continuation ->
        continuation.invokeOnCancellation {
          this.cancel()
        }
        this.enqueue(
          object : Callback {
            override fun onFailure(
              call: Call,
              e: IOException,
            ) {
              continuation.resumeWithException(e)
            }
    
            override fun onResponse(
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Thu Apr 18 01:24:38 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/kt/DevServer.kt

    class DevServer {
      val handshakeCertificates = TlsUtil.localhost()
    
      val server =
        MockWebServer().apply {
          useHttps(handshakeCertificates.sslSocketFactory(), false)
    
          enqueue(
            MockResponse()
              .setResponseCode(HTTP_MOVED_TEMP)
              .setHeader("Location", "https://www.google.com/robots.txt"),
          )
        }
    
      val clientCertificates =
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  4. mockwebserver/src/main/kotlin/mockwebserver3/QueueDispatcher.kt

          // Fail fast if there's no response queued up.
          return failFastResponse!!
        }
    
        val result = responseQueue.take()
    
        // If take() returned because we're shutting down, then enqueue another dead letter so that any
        // other threads waiting on take() will also return.
        if (result == DEAD_LETTER) responseQueue.add(DEAD_LETTER)
    
        return result
      }
    
      override fun peek(): MockResponse {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Tue Jan 23 14:31:42 UTC 2024
    - 3K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/LoomTest.kt

        return Executors::class.java.getMethod("newVirtualThreadPerTaskExecutor").invoke(null) as ExecutorService
      }
    
      @Test
      fun testRequest() {
        server.enqueue(MockResponse())
    
        val request = Request(server.url("/"))
    
        client.newCall(request).execute().use {
          assertThat(it.code).isEqualTo(200)
        }
      }
    
      @Test
      fun testIfSupported() {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 2K bytes
    - Viewed (0)
  6. native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt

      val clientRule = OkHttpClientTestRule()
    
      @Test
      fun passingTest() {
        assertThat("hello").isEqualTo("hello")
      }
    
      @Test
      fun testMockWebServer(server: MockWebServer) {
        server.enqueue(MockResponse(body = "abc"))
    
        val client = clientRule.newClient()
    
        client.newCall(Request(url = server.url("/"))).execute().use {
          assertThat(it.body.string()).isEqualTo("abc")
        }
      }
    
      @Test
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  7. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/MockWebServer.kt

        message = "moved to val",
        replaceWith = ReplaceWith(expression = "requestCount"),
        level = DeprecationLevel.ERROR,
      )
      fun getRequestCount(): Int = delegate.requestCount
    
      fun enqueue(response: MockResponse) {
        delegate.enqueue(response.wrap())
      }
    
      @Throws(IOException::class)
      @JvmOverloads
      fun start(port: Int = 0) {
        started = true
        delegate.start(port)
      }
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Tue Jan 23 14:31:42 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/SessionReuseTest.kt

                  }
                },
              ),
            )
            .sslSocketFactory(sslSocketFactory, handshakeCertificates.trustManager)
            .build()
    
        server.enqueue(MockResponse(body = "abc1"))
        server.enqueue(MockResponse(body = "abc2"))
    
        val request = Request(server.url("/"))
    
        client.newCall(request).execute().use { response ->
          assertEquals(200, response.code)
        }
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 6K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/PrintEvents.java

          .build();
    
      public void run() throws Exception {
        Request washingtonPostRequest = new Request.Builder()
            .url("https://www.washingtonpost.com/")
            .build();
        client.newCall(washingtonPostRequest).enqueue(new Callback() {
          @Override public void onFailure(Call call, IOException e) {
          }
    
          @Override public void onResponse(Call call, Response response) throws IOException {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Feb 16 23:20:49 UTC 2020
    - 6.1K bytes
    - Viewed (0)
  10. samples/compare/src/test/kotlin/okhttp3/compare/JettyHttpClientTest.kt

      private val client = HttpClient()
    
      @BeforeEach fun setUp() {
        client.start()
      }
    
      @AfterEach fun tearDown() {
        client.stop()
      }
    
      @Test fun get(server: MockWebServer) {
        server.enqueue(MockResponse(body = "hello, Jetty HTTP Client"))
    
        val request =
          client.newRequest(server.url("/").toUri())
            .header("Accept", "text/plain")
        val response = request.send()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 2K bytes
    - Viewed (0)
Back to top