de.unkrig.commons.net
Class ReverseProxy
java.lang.Object
de.unkrig.commons.net.ReverseProxy
- All Implemented Interfaces:
- RunnableWhichThrows<java.io.IOException>, Stoppable
public class ReverseProxy
- extends java.lang.Object
- implements RunnableWhichThrows<java.io.IOException>, Stoppable
A server that accepts connections from clients on a local port/bind address, and, for each accepted connection,
establishes another connection to a remote port/address, and then invokes a ReverseProxy.ProxyConnectionHandler.
- See Also:
ReverseProxy(InetSocketAddress, int, InetSocketAddress, Proxy, int, ProxyConnectionHandler)
|
Constructor Summary |
ReverseProxy(java.net.InetSocketAddress endpoint,
int backlog,
java.net.InetSocketAddress serverAddress,
java.net.Proxy serverConnectionProxy,
int serverConnectionTimeout,
ReverseProxy.ProxyConnectionHandler proxyConnectionHandler)
|
|
Method Summary |
java.net.InetSocketAddress |
getEndpointAddress()
|
void |
run()
"To run" an instance means to call this method and wait until it returns. |
void |
stop()
Returns when this Stoppable has completely stopped. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReverseProxy
public ReverseProxy(java.net.InetSocketAddress endpoint,
int backlog,
java.net.InetSocketAddress serverAddress,
java.net.Proxy serverConnectionProxy,
int serverConnectionTimeout,
ReverseProxy.ProxyConnectionHandler proxyConnectionHandler)
throws java.io.IOException
- Parameters:
endpoint - The local TCP port (see ServerSocket.ServerSocket(int) and the local
interface this reverse proxy will bind to, see ServerSocket.ServerSocket(int, int, InetAddress)backlog - The listen backlog (see ServerSocket.ServerSocket(int, int)serverAddress - Address of the remote server to connect toserverConnectionProxy - Used to create connections to the remote server; see Socket.Socket(Proxy)serverConnectionTimeout - See Socket.connect(java.net.SocketAddress, int)
- Throws:
java.io.IOException
getEndpointAddress
public java.net.InetSocketAddress getEndpointAddress()
- Returns:
- The local address of the passive socket of the reverse proxy
run
public void run()
throws java.io.IOException
- Description copied from interface:
RunnableWhichThrows
- "To run" an instance means to call this method and wait until it returns.
- Specified by:
run in interface RunnableWhichThrows<java.io.IOException>
- Throws:
java.io.IOException
stop
public void stop()
- Description copied from interface:
Stoppable
- Returns when this
Stoppable has completely stopped.
- Specified by:
stop in interface Stoppable