adds server mode with tests

Created tests for @jeremybmerrill's solution for issue #18