throw transport exception instead of returning invalid response

Fixes #9 

List of changes below:

- throw exception instead of returning invalid response
- added wrapper around curl_* functions that alows us to mock them
- wrote some test that covers curl error