Bug 1028451, 1028899 — Handle SIGTERM.

- Wait for server stopping accepting new connections before calling process.exit(0);
- Adds tests for the shutdown implementation.

r=Alexis,Natim
Merge pull request #119 from mozilla-services/clean-shutdown-on-SIGTERM

Bug 1028451 - Tweak shutdown to be testable and test it