Cannot re-use an agent for several HTTPS requests

I discovered it when trying to write a new output for logstash using a custom http rest services, and it seems also to be failing in the current logstash http output, see
https://logstash.jira.com/browse/LOGSTASH-882