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

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