Reputation: 8979
I’m building a client server application that should operate 24/7. The applications is designate to detect network failures (using a heart beating) and reconnect to the server asap.
The first test that I made is just stopping the client or the server and then starting again and everything works fine. I’m wondering if there is any tools that can help me simulate congestion, delays or more realistic problem than just unplugging my Ethernet cable.
Upvotes: 4
Views: 2229
Reputation: 4586
Sniffy allows you to block outgoing network connections in your Java applications - it will throw a ConnectException
whenever you try to establish a new connection to restricted host.
Just add -javaagent:sniffy.jar=5559
to your JVM arguments and point your browser to localhost:5559
- it will open a web page with all discovered connections to downstream systems and controls to disable certain connections.
Currently (as of version 3.1.3) it only supports no-connectivity scenarios, but adding latency is on the road map.
Disclaimer: I'm the author of Sniffy
Upvotes: 1
Reputation: 28419
Does the app use plain tcp sockets? Or does it use HTTP/HTTPS? If its HTTP based, Fiddler (as well as some other proxy servers) has the capability of simulating slow connection speeds, albeit at the expense of being windows only.
Alternatively, I've had good experiences with tools like Apache TCPMon and its ilk. These can simulate congestion and line breaks fairly well, although in my experience, you will still end up finding new and interesting failure modes in the real world.
Upvotes: 3