Sockets abstraction refactoring