Handle "Connection Refused" gracefully

This should solve the problem we've been having.

Also added some tests + automated cloud-based testing from travis-ci.org