@Override
    public synchronized void write(byte b[], int off, int len) throws IOException {
        super.write(b, off, len);
        amountTransferred.addAndGet(len);
    }
An output stream which tracks the amount of bytes transfered by proxy sockets.
xmppserver/src/main/java/org/jivesoftware/openfire/filetransfer/proxy/ProxyOutputStream.java