Class DefaultMockServer

    • Method Detail

      • start

        public final void start()
      • start

        public final void start​(int port)
      • start

        public final void start​(InetAddress inetAddress,
                                int port)
      • shutdown

        public final void shutdown()
      • reset

        public void reset()
      • url

        public String url​(String path)
        Returns a String URL for connecting to this server.
        Specified by:
        url in interface MockServer
        Parameters:
        path - the request path, such as "/".
      • getSelfSignedCertificate

        public io.vertx.core.net.SelfSignedCertificate getSelfSignedCertificate()
        Returns the SelfSignedCertificate for the Mock Web Server.
        Specified by:
        getSelfSignedCertificate in interface MockServer
        Returns:
        the SelfSignedCertificate for the MockWebServer.
      • getRequestCount

        public int getRequestCount()
        Returns the number of HTTP requests received thus far by this server. This may exceed the number of HTTP connections when connection reuse is in practice.
        Specified by:
        getRequestCount in interface MockServer
      • takeRequest

        public RecordedRequest takeRequest()
                                    throws InterruptedException
        Awaits the next HTTP request, removes it, and returns it. Callers should use this to verify the request was sent as intended. This method will block until the request is available, possibly forever.
        Specified by:
        takeRequest in interface MockServer
        Returns:
        the head of the request queue
        Throws:
        InterruptedException
      • takeRequest

        public RecordedRequest takeRequest​(long timeout,
                                           TimeUnit unit)
                                    throws InterruptedException
        Awaits the next HTTP request (waiting up to the specified wait time if necessary), removes it, and returns it. Callers should use this to verify the request was sent as intended within the given time.
        Specified by:
        takeRequest in interface MockServer
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        the head of the request queue
        Throws:
        InterruptedException