Class MockDispatcher
- java.lang.Object
-
- io.fabric8.mockwebserver.http.Dispatcher
-
- io.fabric8.mockwebserver.internal.MockDispatcher
-
public class MockDispatcher extends Dispatcher
-
-
Constructor Summary
Constructors Constructor Description MockDispatcher(Map<ServerRequest,Queue<ServerResponse>> responses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MockResponsedispatch(RecordedRequest request)Returns a response to satisfyrequest.voidreleaseResources()Release any per-connection resources that must outlive in-flight dispatches.-
Methods inherited from class io.fabric8.mockwebserver.http.Dispatcher
shutdown
-
-
-
-
Constructor Detail
-
MockDispatcher
public MockDispatcher(Map<ServerRequest,Queue<ServerResponse>> responses)
-
-
Method Detail
-
dispatch
public MockResponse dispatch(RecordedRequest request)
Description copied from class:DispatcherReturns a response to satisfyrequest. This method may block (for instance, to wait on a CountdownLatch).- Specified by:
dispatchin classDispatcher
-
releaseResources
public void releaseResources()
Description copied from class:DispatcherRelease any per-connection resources that must outlive in-flight dispatches.Called after the HTTP server has stopped accepting new connections, so it is safe to tear down state that an in-flight handler might otherwise touch (for example a WebSocket session's
ScheduledExecutorServiceused to deliveronOpenmessages).Note: Vert.x
HttpServer.close()does not strictly wait for every in-flight WebSocket upgrade to deliver itsonOpencallback before completing, so callers that schedule onto resources released here must still be defensive against a shutdown that races with a late upgrade (seeWebSocketSession.send).The default implementation is a no-op.
- Overrides:
releaseResourcesin classDispatcher
-
-