stream protocol and server refactoring
add write flow control to http protocol response