What you're looking for is simply outside of the scope for a universal java application.
If you're planning on keeping a specific OS in mind, such as Windows or Linux (my following examples), then there are a few things you can do.
For Windows, any given application will be unable to do this without driver privileges. WinPCap is probably the most widely used tool in this case, and that's what jpcap utilizes. It's a "driver" that basically just Man-in-the-middle's your traffic.
For Linux, take a look at this other post https://security.stackexchange.com/questions/13267/monitoring-outgoing-network-traffic
I know this is a sideways answer since it gives no Java code, but that's because Java simply isn't built to interface with the system in that way.