Added server mode with tests

Server mode added by @jeremybmerrill's solution for issue #18