Updated sockets communication, added tests