Added socket functionality and test