Handle closed connections from clients
Add integration tests