ported tests to mocha. improvements to startup/shutdown flow