Fixed test_for_connection

Fixed test_for_connection to return properly when no connection was
accepted