Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for QueueDispatcher (0.22 sec)

  1. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/QueueDispatcher.kt

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package okhttp3.mockwebserver
    
    import mockwebserver3.QueueDispatcher
    
    class QueueDispatcher : Dispatcher() {
      internal val delegate = QueueDispatcher()
    
      @Throws(InterruptedException::class)
      override fun dispatch(request: RecordedRequest): MockResponse {
        throw UnsupportedOperationException("unexpected call")
      }
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Oct 18 12:55:43 UTC 2020
    - 1.3K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. mockwebserver/api/mockwebserver3.api

    	public final fun getPath ()Ljava/lang/String;
    	public final fun getResponse ()Lmockwebserver3/MockResponse;
    }
    
    public class mockwebserver3/QueueDispatcher : mockwebserver3/Dispatcher {
    	public static final field Companion Lmockwebserver3/QueueDispatcher$Companion;
    	public fun <init> ()V
    	public fun clear ()V
    	public fun dispatch (Lmockwebserver3/RecordedRequest;)Lmockwebserver3/MockResponse;
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Tue Jan 03 21:59:45 UTC 2023
    - 12.7K bytes
    - Viewed (0)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top