Add null checks
Modify tests to use one web socket connection
Fix shim in main-test.js, run tests after timeout