@Override
    public void doTransfer() throws IOException {
        if (!isActivatable()) {
            throw new IOException("Transfer missing party");
        }

        try (InputStream in = getInputStream()) {
            try (OutputStream out = new ProxyOutputStream(getOutputStream())) {

                final byte[] b = new byte[BUFFER_SIZE];
                int count = 0;
                amountWritten = 0;

                do {
                    // write to the output stream
                    out.write(b, 0, count);

                    amountWritten += count;

                    // read more bytes from the input stream
                    count = in.read(b);
                } while (count >= 0);
            }
        }
    }
Tracks the different connections related to a file transfer. There are two connections, the
initiator and the target and when both connections are completed the transfer can begin.
xmppserver/src/main/java/org/jivesoftware/openfire/filetransfer/proxy/DefaultProxyTransfer.java