NEXUS-7575: User agent not set on HC4 tunneled connections

When HC4 tunnels HTTPS connection over HTTP, using
CONNECT, the user agent is not set even if it is configured
(HTTPCLIENT-1526). This change applies the fix
mentioned in issue comment and adds a test
that verifies it works.

Issue
https://issues.sonatype.org/browse/NEXUS-7575

CI
http://bamboo.s/browse/NX-OSSF331
@mcculls Right, good spot: the method _without_ context would not add UA customisation either, so would not fix the issue in the first place. Also, applying the comment re final local variable. Thanks.