|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.elca.el4j.services.tcpforwarder.TcpForwarder
public class TcpForwarder
A TcpForwarder represents a service intended to forward TCP traffic directed to a specific port. Specifically, it permits to programmatically halt and resume network connectivity.
Since this is a Java class, it can not intercept traffic not destined for it. However, it can masquerade for a remote application by forwarding traffic to and from it achieving the same effect but for requiring the application to connect on the forwarder's port.
Field Summary | |
---|---|
protected Set<Link> |
m_activeLinks
The set of active links. |
protected int |
m_listenPort
The listen port. |
protected InetSocketAddress |
m_targetAddress
The internet socket address to forward traffic to. |
Constructor Summary | |
---|---|
TcpForwarder(int listenPort,
InetSocketAddress targetAddress)
Forwarder to listen on local port and forward to given target address. |
|
TcpForwarder(int listenPort,
int targetPort)
Forwarder to listen and forward to local ports. |
Method Summary | |
---|---|
static InetSocketAddress |
getLocalSocketAddress(int port)
|
void |
plug()
Starts forwarding tcp messages. |
void |
run()
This method is not intended to be invoked from the outside. |
void |
unplug()
Stops forwarding tcp messages. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int m_listenPort
protected InetSocketAddress m_targetAddress
protected Set<Link> m_activeLinks
Constructor Detail |
---|
public TcpForwarder(int listenPort, int targetPort)
listenPort
- Is the input port.targetPort
- Is the output port.public TcpForwarder(int listenPort, InetSocketAddress targetAddress)
listenPort
- Is the input port.targetAddress
- Is the target internet socket address to forward to.Method Detail |
---|
public static InetSocketAddress getLocalSocketAddress(int port)
port
- Is the local port for the socket.
public void run()
run
in interface Runnable
public void plug()
public void unplug()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |