restructured the source to put tests with the other files.
server now starts and stops when requested.