Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for queueDispatcher (0.11 sec)

  1. mockwebserver/src/main/kotlin/mockwebserver3/QueueDispatcher.kt

    import okhttp3.ExperimentalOkHttpApi
    
    /**
     * Default dispatcher that processes a script of responses. Populate the script by calling [enqueueResponse].
     */
    @ExperimentalOkHttpApi
    open class QueueDispatcher : Dispatcher() {
      protected val responseQueue: BlockingQueue<MockResponse> = LinkedBlockingQueue()
      private var failFastResponse: MockResponse? = null
    
      @Throws(InterruptedException::class)
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Tue Jan 23 14:31:42 UTC 2024
    - 3K bytes
    - Viewed (0)
  2. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/KotlinSourceModernTest.kt

      }
    
      @Test @Ignore
      fun queueDispatcher() {
        val queueDispatcher: QueueDispatcher = QueueDispatcher()
        var mockResponse: MockResponse =
          queueDispatcher.dispatch(
            RecordedRequest("", headersOf(), listOf(), 0L, Buffer(), 0, Socket()),
          )
        mockResponse = queueDispatcher.peek()
        queueDispatcher.enqueueResponse(MockResponse())
        queueDispatcher.shutdown()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

      }
    
      @Test
      fun queueDispatcher() {
        val queueDispatcher = QueueDispatcher()
        var mockResponse: MockResponse =
          queueDispatcher.dispatch(
            RecordedRequest("", headersOf(), listOf(), 0L, Buffer(), 0, Socket()),
          )
        mockResponse = queueDispatcher.peek()
        queueDispatcher.enqueueResponse(MockResponse())
        queueDispatcher.shutdown()
        queueDispatcher.setFailFast(false)
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Apr 01 14:21:25 UTC 2024
    - 46.5K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.kt

        server.useHttps(handshakeCertificates.sslSocketFactory())
        val queueDispatcher = QueueDispatcher()
        queueDispatcher.enqueueResponse(MockResponse(inTunnel = true))
        queueDispatcher.enqueueResponse(MockResponse(inTunnel = true))
        queueDispatcher.enqueueResponse(MockResponse(body = "call2 response"))
        queueDispatcher.enqueueResponse(MockResponse(body = "call1 response"))
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Thu Apr 11 22:09:35 UTC 2024
    - 75.3K bytes
    - Viewed (0)
  5. mockwebserver/src/main/kotlin/mockwebserver3/MockWebServer.kt

      /**
       * The dispatcher used to respond to HTTP requests. The default dispatcher is a [QueueDispatcher],
       * which serves a fixed sequence of responses from a [queue][enqueue].
       *
       * Other dispatchers can be configured. They can vary the response based on timing or the content
       * of the request.
       */
      var dispatcher: Dispatcher = QueueDispatcher()
    
      private var portField: Int = -1
      val port: Int
        get() {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Mar 31 17:16:15 UTC 2024
    - 37.4K bytes
    - Viewed (0)
  6. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/DeprecationBridge.kt

    import mockwebserver3.SocketPolicy.ShutdownServerAfterResponse
    import mockwebserver3.SocketPolicy.StallSocketAtStart
    
    internal fun Dispatcher.wrap(): mockwebserver3.Dispatcher {
      if (this is QueueDispatcher) return this.delegate
    
      val delegate = this
      return object : mockwebserver3.Dispatcher() {
        override fun dispatch(request: mockwebserver3.RecordedRequest): mockwebserver3.MockResponse {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  7. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/MockWebServer.kt

      val requestCount: Int by delegate::requestCount
    
      var bodyLimit: Long by delegate::bodyLimit
    
      var serverSocketFactory: ServerSocketFactory? by delegate::serverSocketFactory
    
      var dispatcher: Dispatcher = QueueDispatcher()
        set(value) {
          field = value
          delegate.dispatcher = value.wrap()
        }
    
      val port: Int
        get() {
          before() // This implicitly starts the delegate.
          return delegate.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. mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt

        }
        server.url("/b").toUrl().openConnection().getInputStream() // Should succeed.
      }
    
      @Test
      fun clearDispatcherQueue() {
        server.enqueue(MockResponse(body = "A"))
        (server.dispatcher as QueueDispatcher).clear()
        server.enqueue(MockResponse(body = "B"))
        val inputStream = server.url("/a").toUrl().openConnection().getInputStream()
        assertThat(inputStream!!.read()).isEqualTo('B'.code)
      }
    
      /**
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  9. CHANGELOG.md

        possible to implement decorators for cache encryption or compression.
     *  New: `Cookie.newBuilder()` to build upon an existing cookie.
     *  New: Use TLSv1.3 when running on JDK 8u261 or newer.
     *  New: `QueueDispatcher.clear()` may be used to reset a MockWebServer instance.
     *  New: `FileDescriptor.toRequestBody()` may be particularly useful for users of Android's Storage
        Access Framework.
     *  Upgrade: [Kotlin 1.5.31][kotlin_1_5_31].
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Thu Apr 18 01:31:39 UTC 2024
    - 21.4K bytes
    - Viewed (0)
  10. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

          fail<Any>()
        } catch (expected: ConnectException) {
        }
      }
    
      @Test
      fun shutdownWhileBlockedDispatching() {
        // Enqueue a request that'll cause MockWebServer to hang on QueueDispatcher.dispatch().
        val connection = server.url("/").toUrl().openConnection() as HttpURLConnection
        connection.setReadTimeout(500)
        try {
          connection.getResponseCode()
          fail<Any>()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 21.9K bytes
    - Viewed (0)
Back to top