Refactor socket manager. Introduce socket channels.