Class TestServer
java.lang.Object
io.fluxzero.testserver.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.
-
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
-