Update URLConnectionTest due to OkHttp bugfix backport

Applies changes to URLConnectionTest required for a corresponding
external/okhttp commit (backporting upstream commit
7ceaa2387f0be853222f5a1496f1f743fa6f8c6d) that fixes two bugs:

 (1.) when attempting to tunnel a https connection over http, the host
      header now include the :443, like it should. URLConnectionTest
      was previously incorrectly asserting that the :443 was missing;
      this CL fixes that assertion.
 (2.) A bug in connecting to URLs with literal IPv6 addresses has been
      fixed. This probably fixes bug 31917371 but this has not yet been
      empirically verified. This CL adds a test to guard against
      regression.

More details for (2.):

Between commit c358656c8799d30fd422448153e99a5dd37e298a (OkHttp 2.7.0)
and 7ceaa2387f0be853222f5a1496f1f743fa6f8c6d (OkHttp 3.2.0), upstream
OkHttp had a bug where a roundtrip HttpUrl -> host -> HttpUrl would
fail for literal IPv6 address hosts because the getter would return
the address without [] but the setter would only accept it wrapped in [].

Since Android's HttpURLConnection is derived from OkHttp 2.7.5, this
caused a crash when attempting a HttpURLConnection to a literal IPv6 URL.

Test: cts-tradefed run cts -m CtsLibcoreTestCases

Bug: 31917371

Change-Id: Ib4ee91356e7f11fe6f55e1cfd8f319f714a4567a
1 file changed