Refactor connection tests a bit more