Make sure writing empty ByteBuf will not cause a stavation.

This also fixes [#1436]