Fix URLConnectionTest.testConnectTimeouts() by dropping use of Mockito
This test used a Mockito spy to wrap a Socket instance. It has been failing on AOSP for (at least) weeks due to what appears like a bug in AOSP's version of Mockito; this bug can lead to crashes in <clinit>, or the expectations set up on the spy not working correctly. There is probably some way we could call the Mockito API to cause the static initializers to run in a different order and work around the bug, but that would require more investigation and would likely still be fragile. It doesn't seem like a good trade-off as long as this only affects isolated cases. Therefore this CL replaces the spy with an explicit DelegatingSocket wrapper instead. This avoids the need to investigate a potentially fragile workaround for the Mockito behavior and increases clarity by removing the runtime magic. Bug: 29095428 Change-Id: I46d57f18d9ea157e8a34ce3aead55e0f97de458a
Loading
Please sign in to comment