Improve error handling when something goes wrong with the server
Since close is async, thread.sleep in the test
Fix for #14
Fix the test
Since close is async, avoid side effect in the test