Add ConnectionFactory abstraction for creating new HTTP connections.

This allows us to plug other `HttpUrlConnection`-compatible implementations
into the helpers.