Package io.fluxcapacitor.proxy
Class ProxyServer
java.lang.Object
io.fluxcapacitor.proxy.ProxyServer
- All Implemented Interfaces:
Registration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels the resource or subscription associated with this registration.static void
static ProxyServer
start
(int port, ProxyRequestHandler proxyHandler) Starts a proxy server on the specified port with the given proxy request handler.static ProxyServer
start
(ProxyRequestHandler proxyHandler) Starts a proxy server on a random available port with the specified proxy request handler.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.Registration
merge
-
Constructor Details
-
ProxyServer
public ProxyServer()
-
-
Method Details
-
main
-
start
Starts a proxy server on a random available port with the specified proxy request handler. The server will listen for HTTP requests and route them through the provided handler.- Parameters:
proxyHandler
- the handler responsible for processing proxy requests.- Returns:
- a ProxyServer instance representing the started proxy server, allowing further management such as shutdown.
-
start
Starts a proxy server on the specified port with the given proxy request handler. The server will listen for HTTP requests and route them through the provided handler. Additionally, it sets up a health endpoint that responds with a simple "Healthy" message.- Parameters:
port
- the port number on which the proxy server will listen. Use 0 to select a random available port.proxyHandler
- the handler responsible for processing proxy requests.- Returns:
- a ProxyServer instance representing the started proxy server, allowing further management such as shutdown.
-
cancel
public void cancel()Description copied from interface:Registration
Cancels the resource or subscription associated with this registration.Calling this method should be idempotent and safe to invoke multiple times.
- Specified by:
cancel
in interfaceRegistration
-