Add tests for mock server.
Refactor tests.
Tests now pass.