Source:
public void testProxyAuthConnectionFailed ( ) throws java.lang.Throwable { org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.setUpStoreProperties ( ) ; java.net.ServerSocket ss = new java.net.ServerSocket ( 0 ) ; org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.TestHostnameVerifier hnv = new org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.TestHostnameVerifier ( ) ; javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier ( hnv ) ; java.net.URL url = new java.net.URL ( "https://requested.host:55555/requested.data" ) ; javax.net.ssl.HttpsURLConnection connection = ( ( javax.net.ssl.HttpsURLConnection ) ( url.openConnection ( new java.net.Proxy ( java.net.Proxy.Type.HTTP , new java.net.InetSocketAddress ( "localhost" , ss.getLocalPort ( ) ) ) ) ) ) ; connection.setSSLSocketFactory ( org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.getContext ( ) . getSocketFactory ( ) ) ; try { org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.doInteraction ( connection , ss , org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.AUTHENTICATION_REQUIRED_CODE , true ) ; } catch ( java.io.IOException e ) { if ( org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.DO_LOG ) { java.lang.System.out.println ( ( "Got expected IOException: " + ( e.getMessage ( ) ) ) ) ; } } }

Target:
public void testProxyAuthConnectionFailed ( ) throws java.lang.Throwable { org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.setUpStoreProperties ( ) ; javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier ( new org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.TestHostnameVerifier ( ) ) ; com.google.mockwebserver.MockWebServer proxyAndWebServer = new com.google.mockwebserver.MockWebServer ( ) ; org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.ProxyConnectAuthFailDispatcher authFailDispatcher = new org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.ProxyConnectAuthFailDispatcher ( ) ; proxyAndWebServer.setDispatcher ( authFailDispatcher ) ; proxyAndWebServer.play ( ) ; java.net.URL proxyUrl = proxyAndWebServer.getUrl ( "/" ) ; java.net.InetSocketAddress proxyAddress = new java.net.InetSocketAddress ( "localhost" , proxyUrl.getPort ( ) ) ; java.net.URL url = new java.net.URL ( "https://requested.host:55555/requested.data" ) ; javax.net.ssl.HttpsURLConnection connection = ( ( javax.net.ssl.HttpsURLConnection ) ( url.openConnection ( new java.net.Proxy ( java.net.Proxy.Type.HTTP , proxyAddress ) ) ) ) ; connection.setSSLSocketFactory ( org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.getContext ( ) . getSocketFactory ( ) ) ; try { org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.executeClientRequest ( connection , false ) ; } catch ( java.io.IOException e ) { if ( org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.DO_LOG ) { java.lang.System.out.println ( ( "Got expected IOException: " + ( e.getMessage ( ) ) ) ) ; } } }