Fix two bugs related to return=stream. Also added tests to cover these two bugs.
Fixed socket.io for local server.
Added a failing test for the bug that with return=stream, server returns incomplete data.