Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 107 for enqueue (0.18 sec)

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

          }
    
          override fun writeTo(sink: BufferedSink) {
            sink.writeUtf8("<element/>")
            sink.flush()
          }
        }
    
        server.enqueue(MockResponse(code = 201))
        server.enqueue(MockResponse(code = 204))
        server.enqueue(MockResponse(code = 204))
    
        val endpointUrl = server.url("/endpoint")
    
        var request =
          Request.Builder()
            .url(endpointUrl)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/ConnectionListenerTest.kt

        server!!.enqueue(MockResponse())
        assertSuccessfulEventOrder()
      }
    
      @Test
      @Throws(IOException::class)
      fun multipleDnsLookupsForSingleCall() {
        server!!.enqueue(
          MockResponse(
            code = 301,
            headers = headersOf("Location", "http://www.fakeurl:" + server!!.port),
          ),
        )
        server!!.enqueue(MockResponse())
        val dns = FakeDns()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  3. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourcesHttpTest.kt

      @BeforeEach
      fun before(server: MockWebServer) {
        this.server = server
      }
    
      @AfterEach
      fun after() {
        listener.assertExhausted()
      }
    
      @Test
      fun processResponse() {
        server.enqueue(
          MockResponse.Builder()
            .body(
              """
              |data: hey
              |
              |
              """.trimMargin(),
            ).setHeader("content-type", "text/event-stream")
            .build(),
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  4. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.kt

            .build()
        server.enqueue(
          MockResponse.Builder()
            .headersDelay(500, TimeUnit.MILLISECONDS)
            .setHeader("content-type", "text/event-stream")
            .body("data: hey\n\n")
            .build(),
        )
        newEventSource()
        listener.assertFailure("timeout")
      }
    
      @Test
      fun retainsAccept() {
        server.enqueue(
          MockResponse.Builder()
            .body(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/Call.kt

       *
       * @throws IllegalStateException when the call has already been executed.
       */
      fun enqueue(responseCallback: Callback)
    
      /** Cancels the request, if possible. Requests that are already complete cannot be canceled. */
      fun cancel()
    
      /**
       * Returns true if this call has been either [executed][execute] or [enqueued][enqueue]. It is an
       * error to execute a call more than once.
       */
      fun isExecuted(): Boolean
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/DuplexTest.kt

            .requestIOException()
            .exhaustResponse()
        server.enqueue(
          MockResponse.Builder()
            .clearHeaders()
            .code(HttpURLConnection.HTTP_MOVED_PERM)
            .addHeader("Location: /b")
            .streamHandler(body)
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .body("this is /b")
            .build(),
        )
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 23.9K bytes
    - Viewed (0)
  7. okhttp-coroutines/src/test/kotlin/okhttp3/SuspendCallTest.kt

      @Test
      fun suspendCall() {
        runTest {
          server.enqueue(MockResponse(body = "abc"))
    
          val call = client.newCall(request)
    
          call.executeAsync().use {
            withContext(Dispatchers.IO) {
              assertThat(it.body.string()).isEqualTo("abc")
            }
          }
        }
      }
    
      @Test
      fun timeoutCall() {
        runTest {
          server.enqueue(
            MockResponse.Builder()
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Fri Apr 05 11:25:23 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  8. okhttp-coroutines/src/test/kotlin/okhttp3/coroutines/ExecuteAsyncTest.kt

      @Test
      fun suspendCall() {
        runTest {
          server.enqueue(MockResponse(body = "abc"))
    
          val call = client.newCall(request)
    
          call.executeAsync().use {
            withContext(Dispatchers.IO) {
              assertThat(it.body.string()).isEqualTo("abc")
            }
          }
        }
      }
    
      @Test
      fun timeoutCall() {
        runTest {
          server.enqueue(
            MockResponse.Builder()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/ws/RealWebSocket.kt

       * Attempts to remove a single frame from a queue and send it. This prefers to write urgent pongs
       * before less urgent messages and close frames. For example it's possible that a caller will
       * enqueue messages followed by pongs, but this sends pongs followed by messages. Pongs are always
       * written in the order they were enqueued.
       *
       * If a frame cannot be sent - because there are none enqueued or because the web socket is not
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 22.1K bytes
    - Viewed (0)
  10. 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(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 1.5K bytes
    - Viewed (0)
Back to top