Fix error handling in HttpProtocol
Close the connection on response errors + few code improvements
Merge pull request #263 from wajam/clement-fix-error-handling

Fix error handling in HttpProtocol