Randomly pick the socks and control port in test_settings.

This fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763264
Set the datadirectory to be that of the repo.