Remove duplicate optimist dependency, add mocha as a development dependency
Break most of the server related code out to it's own file and heavily refactor it to make it more testable.
Add initial test suite