Class Http3Server

java.lang.Object
org.mockserver.netty.http3.Http3Server

public class Http3Server extends Object
HTTP/3 (QUIC) server for MockServer, integrated with the full request pipeline.

When started, HTTP/3 requests are routed through the same expectation matching, action handling, recording, and proxy forwarding pipeline as HTTP/1.1 and HTTP/2.

The server uses MockServer's configured TLS certificate material. If no custom certificate is configured, MockServer's auto-generated BouncyCastle certificate is used. The QUIC transport requires a native BoringSSL library; if unavailable at startup the server logs a warning and does not start (fail-soft).

HTTP/3 is OFF by default (http3Port=0) and is built on the Netty 4.2 netty-codec-http3 module (graduated from the incubator). HTTP/3 support is labelled experimental because the API may evolve.

  • Constructor Details

    • Http3Server

      public Http3Server(Configuration configuration, MockServerLogger mockServerLogger, HttpState httpState, HttpActionHandler httpActionHandler, LifeCycle server, McpSessionManager mcpSessionManager)
      Create an HTTP/3 server wired into MockServer's request pipeline, with MCP support.
      Parameters:
      configuration - the server configuration
      mockServerLogger - the logger
      httpState - the shared HTTP state (expectations, matchers, etc.)
      httpActionHandler - the action handler for processing matched expectations
      server - the MockServer lifecycle instance (for MCP tool registry)
      mcpSessionManager - the shared MCP session manager (may be null to disable MCP)
    • Http3Server

      public Http3Server(Configuration configuration, MockServerLogger mockServerLogger, HttpState httpState, HttpActionHandler httpActionHandler)
      Create an HTTP/3 server wired into MockServer's request pipeline (no MCP).
      Parameters:
      configuration - the server configuration
      mockServerLogger - the logger
      httpState - the shared HTTP state (expectations, matchers, etc.)
      httpActionHandler - the action handler for processing matched expectations
    • Http3Server

      public Http3Server()
      Legacy constructor for backwards compatibility (echo-only mode). Used by tests that do not need the full pipeline.
  • Method Details

    • start

      public int start(int port) throws Exception
      Start the HTTP/3 server on the given UDP port.
      Parameters:
      port - UDP port to bind; use 0 for an ephemeral port
      Returns:
      the actual bound port
      Throws:
      Exception - if the server cannot start
    • getActiveConnectionCount

      public int getActiveConnectionCount()
      Returns the current number of active QUIC (HTTP/3) connections.
    • getPort

      public int getPort()
      Returns the bound UDP port, or -1 if not started.
    • stop

      public void stop()
      Stop the HTTP/3 server and release resources.
    • isQuicAvailable

      public static boolean isQuicAvailable()
      Check whether the native QUIC transport is available on this platform.
      Returns:
      true if the native BoringSSL QUIC library is loadable