=rem #13960 #13989 #13742 #13985  Optimize EndpointWriter

* Replace stash with internal buffer
* Replace FSM with become