Created interfaces for the socket handling logic to ease testing (and because they're nice :-). Fixed small bug, but desperately need to make unit tests for that. (But in order to unit test communication, interfaces were needed, so here they are)