I need to meter the number of bytes being used by a java application from within java (i.e. I don't have any special access to the JVM other then not having a security manager to deal with) but I need all the bytes sent/received including protocol headers and the like. Anyone have good ideas on how to do this?
The obvious move is to create a new URLConnectionHandler and insert metering into the IO streams. This, however, does not provide me with the header sizes of HTTP/HTTPS messages sent to/from a Java application.