Extracted the server from the rest, for tests.