mockwebserver / okhttp3.mockwebserver / QueueDispatcher

QueueDispatcher

open class QueueDispatcher :Dispatcher

Default dispatcher that processes a script of responses. Populate the script by calling enqueueResponse.

Constructors

Name Summary
<init> Default dispatcher that processes a script of responses. Populate the script by calling enqueueResponse.QueueDispatcher()

Properties

Name Summary
responseQueue val responseQueue:BlockingQueue<MockResponse>

Functions

Name Summary
dispatch Returns a response to satisfy request. This method may block (for instance, to wait on a CountdownLatch).open fun dispatch(request:RecordedRequest):MockResponse
enqueueResponse open fun enqueueResponse(response:MockResponse):Unit
peek Returns an early guess of the next response, used for policy on how an incoming request should be received. The default implementation returns an empty response. Mischievous implementations can return other values to test HTTP edge cases, such as unhappy socket policies or throttled request bodies.open fun peek():MockResponse
setFailFast open fun setFailFast(failFast:Boolean):Unit
open fun setFailFast(failFastResponse:MockResponse?):Unit
shutdown Release any resources held by this dispatcher. Any requests that are currently being dispatched should return immediately. Responses returned after shutdown will not be transmitted: their socket connections have already been closed.open fun shutdown():Unit