daveslab
daveslab

Reputation: 10310

Java library to forward all network traffic from one port to another?

I am trying to some JUnit tests that simulate a server across the network dying. I have an internal utility that allows me to forward traffic from a port on localhost to any port on any other box, and I have used it for these test cases. The problem is that the utility is written in Python and for Unix only so it's hard to automate it inside Eclipse. My question is:

Is there a Java library that can allow me to do this automatically at the drop of a method call?

In effect, I want something like Hoxy (which is for Node.js) but for Java.

Thanks, Dave

Upvotes: 0

Views: 625

Answers (1)

awm
awm

Reputation: 2768

Does it have to be java? netcat exists and works very well for this sort of thing.

http://29a.ch/2009/5/10/forwarding-ports-using-netcat

Upvotes: 2

Related Questions