Writing bytebuffer in chunks. Don't catch throwable but exception and deal with InterruptedException