Fix a segfault. Kudos to aradulovic and jverillard.

Signed-off-by: David Navarro <david.navarro@intel.com>
Tests: change the connection handling

Add utility functions in tests/utils/connection.*

Now we use only IPv4.

Signed-off-by: David Navarro <david.navarro@intel.com>