Use mocha for tests
Add test for closed connections