Handle socket error, add rspec

- added handling of Errno::CONNREFUSED
- added rspecs for happy path and the new error-handling code