connection.py: Implements proper keep-alive check. Skips impossible unit test.