Improved error server shutdown handling
Added basic testing
Merge remote-tracking branch 'origin/master' into Security