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 a limited 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 detected connections to downstream systems and controls to disable certain connections.

If your application is based on a web interface, you can even do it directly from your application open in a browser - see the demo here: http://demo.sniffy.io/owners?lastName=
Click on the widget in the lower right corner, select the Network Connections tab, disconnect and connect to localhost:8967 (database) and reload the page to see it in action.
Disclaimer: I am the author of Sniffy
bedrin
source share