Refactored the way sockets are configured. This includes initial abstraction. Unit tests are working.