refactor socket stop, resume, clear stream