Fix buffer management, wow StringIO is lame
Rewire the transport protocols to the state machine