Class TestServer
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidStandalone process entry point.static voidstart(int port) Starts an embedded test server on the given port without registering a JVM shutdown hook.static org.eclipse.jetty.server.ServerStarts an embedded test server using the configured port.static org.eclipse.jetty.server.ServerstartServer(int port) Starts an embedded test server on the given port.static org.eclipse.jetty.server.ServerstartServer(int port, Duration initialPositionLag) Starts an embedded test server with a configurable look-back for consumers without a stored position.
-
Constructor Details
-
TestServer
public TestServer()
-
-
Method Details
-
main
Standalone process entry point.Do not call this method to embed the test server in another application. Use
startServer(int)instead so the caller owns the server lifecycle and shutdown order. -
start
public static void start(int port) Starts an embedded test server on the given port without registering a JVM shutdown hook.Callers that need to stop the embedded server explicitly should use
startServer(int).- Parameters:
port- the port to bind, or0to select a random available port
-
startServer
public static org.eclipse.jetty.server.Server startServer()Starts an embedded test server using the configured port.The port is resolved from
FLUXZERO_PORT,FLUX_PORT,port, or8888, in that order. The returned Jetty server is owned by the caller and should be stopped by the caller.- Returns:
- the started Jetty server
-
startServer
public static org.eclipse.jetty.server.Server startServer(int port) Starts an embedded test server on the given port.The returned Jetty server is owned by the caller and should be stopped by the caller. This method does not register a JVM shutdown hook, so it can be used safely in applications that coordinate their own shutdown order.
- Parameters:
port- the port to bind, or0to select a random available port- Returns:
- the started Jetty server
-
startServer
Starts an embedded test server with a configurable look-back for consumers without a stored position.The default overload starts new consumers one second before the current end of their log. A larger duration can be useful in local development when a command may be appended shortly before its first matching consumer is registered. Existing stored consumer positions are unaffected. The returned Jetty server is owned by the caller and should be stopped by the caller.
- Parameters:
port- the port to bind, or0to select a random available portinitialPositionLag- duration subtracted from the current time for consumers without a stored position- Returns:
- the started Jetty server
-