Fix #6506 stream: writes can return false but forget to emit drain

Just fix #6506, now it will emit 'drain' event properly.
Test case has been added.