TODO: There is an assumption here that the blocking write will
block until all the data is written or the write times out.
Document this assumption in the Javadoc for doWrite(),
ensure it is valid for all implementations of doWrite() and
then review all callers of doWrite() and review what
simplifications this offers.