Changes in connection.py. Added unittests for connection.py