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
Is there a reason this doesn't use the more detailed `formatUserAgentString(context)` method used in `applyConfig`? Would it be worthwhile precomputing the user-agent string in `prepareHttpClient` and assign it to a final local variable that could then be used in this anonymous class and passed into `applyConfig` rather than have it computed twice per-request?