Mock an HTTP server and add test cases to test state management (issue #1)