Class ProxyServer
java.lang.Object
io.fluxzero.proxy.ProxyServer
- All Implemented Interfaces:
Registration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the resource or subscription associated with this registration.static voidstatic ProxyServerstart(int port, ProxyRequestHandler proxyHandler) Starts a proxy server on the specified port with the given proxy request handler.static ProxyServerstart(ProxyRequestHandler proxyHandler) Starts a proxy server on a random available port with the specified proxy request handler.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:RegistrationCancels the resource or subscription associated with this registration.Calling this method should be idempotent and safe to invoke multiple times.
- Specified by:
cancelin interfaceRegistration
-