Wrote a simple connection-handler and first draft of tests for the server. Minor refactoring in different places.