smarter socket timeouts
added shutdown timeout to avoid hanging
fixing test
not restarting immediatlely
Merge pull request #8 from sebv/smart-timeouts

Smart timeouts