Add some unit tests.

Switch to using pycurl (makes forcing ipv4 easier)