Class Dispatcher

    • Constructor Detail

      • Dispatcher

        public Dispatcher()
    • Method Detail

      • dispatch

        public abstract MockResponse dispatch​(RecordedRequest request)
        Returns a response to satisfy request. This method may block (for instance, to wait on a CountdownLatch).
      • shutdown

        public void 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.
      • releaseResources

        public void releaseResources()
        Release 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 ScheduledExecutorService used to deliver onOpen messages).

        Note: Vert.x HttpServer.close() does not strictly wait for every in-flight WebSocket upgrade to deliver its onOpen callback before completing, so callers that schedule onto resources released here must still be defensive against a shutdown that races with a late upgrade (see WebSocketSession.send).

        The default implementation is a no-op.