Ideally we should wait after transferTo returns 0. But because of
a bug in JRE on Linux (http://bugs.sun.com/view_bug.do?bug_id=5103988),
which throws an exception instead of returning 0, we wait for the
channel to be writable before writing to it. If you ever see
IOException with message \"Resource temporarily unavailable\"
thrown here, please let us know.

Once we move to JAVA SE 7, wait should be moved to correct place.