Package org.mockserver.netty.http3
Class Http3Server
java.lang.Object
org.mockserver.netty.http3.Http3Server
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 Summary
ConstructorsConstructorDescriptionLegacy constructor for backwards compatibility (echo-only mode).Http3Server(Configuration configuration, MockServerLogger mockServerLogger, HttpState httpState, HttpActionHandler httpActionHandler) Create an HTTP/3 server wired into MockServer's request pipeline (no MCP).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. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current number of active QUIC (HTTP/3) connections.intgetPort()Returns the bound UDP port, or -1 if not started.static booleanCheck whether the native QUIC transport is available on this platform.intstart(int port) Start the HTTP/3 server on the given UDP port.voidstop()Stop the HTTP/3 server and release resources.
-
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 configurationmockServerLogger- the loggerhttpState- the shared HTTP state (expectations, matchers, etc.)httpActionHandler- the action handler for processing matched expectationsserver- 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 configurationmockServerLogger- the loggerhttpState- 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
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
-