Fix file transfer failure and refactor test

This pull request fixes #105, file transfer eventually fails due to division by zero error. Also refactors the test of progress monitor.

The bug became obvious since Java 8, because probably execution speed has been faster.