Interface StubHttpServer


  • public interface StubHttpServer
    Interface for a stub http server component.

    This component represents an http server which waits for http requests and returns stub http responses according to a StubHttpServerManager instance.

    Jadler provides a default implementation of this interface net.jadler.stubbing.server.jetty.JettyStubHttpServer based on an embedded jetty server.

    • Method Detail

      • registerRequestManager

        void registerRequestManager​(RequestManager requestManager)
        Registers a response provider. This component provides a response prescription (in form of a StubResponse instance) for a given http request.
        Parameters:
        requestManager - response provider to use to retrieve response prescriptions.
      • start

        void start()
            throws Exception
        Starts the underlying http server. From now, the server must be able to respond according to prescriptions returned from the registered StubHttpServerManager instance.
        Throws:
        Exception - when ugh... something went wrong
      • stop

        void stop()
           throws Exception
        Stops the underlying http server.
        Throws:
        Exception - when an error occurred while stopping the server
      • getPort

        int getPort()
        Returns:
        HTTP server port