Class MockWebServer

    • Constructor Detail

      • MockWebServer

        public MockWebServer()
    • Method Detail

      • start

        public void start()
      • start

        public void start​(int port)
      • start

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

        public void shutdown()
      • getPort

        public int getPort()
      • getHostName

        public String getHostName()
      • toProxyAddress

        public Proxy toProxyAddress()
      • getSelfSignedCertificate

        public io.vertx.core.net.SelfSignedCertificate getSelfSignedCertificate()
      • getRequestCount

        public int getRequestCount()
      • useHttps

        public void useHttps()
      • setDispatcher

        public void setDispatcher​(Dispatcher dispatcher)
      • setProtocols

        public void setProtocols​(List<Protocol> protocols)
      • setHttp2ClearTextEnabled

        public void setHttp2ClearTextEnabled​(boolean http2ClearTextEnabled)
        Enables or disables HTTP/2 over cleartext (h2c). Enabled by default, matching Vert.x's own default. Set to false for tests that use HTTP clients (such as the JDK HttpClient) which probe for Upgrade: h2c — accepting the upgrade can lead to non-deterministic HTTP/2 framing behaviour on large responses.
      • reset

        public final void reset()
        Returns the MockWebServer's recorded-traffic state to initial:
        • Clearing the request count.
        • Clearing the request queue.

        This is intentionally non-destructive w.r.t. the running HTTP server, the configured Dispatcher, the listener list, the SSL/TLS state, the negotiated port, and the selected protocols. It is safe to call on a started server mid-life; callers that need a different dispatcher or expectation set must install those themselves (setDispatcher(Dispatcher)).