Source:
<code>public void testPacProxy() throws Exception { final Uri pacUrl = Uri.parse("https://pac-url"); mCellNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_CELLULAR); mCellNetworkAgent.connect(true); <START> final ProxyInfo initialProxyInfo = ProxyInfo.buildPacProxy(pacUrl); <END> mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI); mWiFiNetworkAgent.connect(true); final LinkProperties testLinkProperties = new LinkProperties(); testLinkProperties.setHttpProxy(initialProxyInfo); mWiFiNetworkAgent.sendLinkProperties(testLinkProperties); waitForIdle(); final ProxyInfo unstartedDefaultProxyInfo = mService.getProxyForNetwork(null); final ProxyInfo unstartedWifiProxyInfo = mService.getProxyForNetwork( mWiFiNetworkAgent.getNetwork()); final LinkProperties unstartedLp = mService.getLinkProperties(mWiFiNetworkAgent.getNetwork()); assertEquals(initialProxyInfo, unstartedDefaultProxyInfo); assertEquals(initialProxyInfo, unstartedWifiProxyInfo); assertEquals(initialProxyInfo, unstartedLp.getHttpProxy()); assertNull(mService.getLinkProperties(mCellNetworkAgent.getNetwork()).getHttpProxy()); final ProxyInfo servingProxyInfo = new ProxyInfo("localhost", 2097, ""); mService.updateProxyInfoForPac(servingProxyInfo); waitForIdle(); final ProxyInfo startedDefaultProxyInfo = mService.getProxyForNetwork(null); final ProxyInfo startedWifiProxyInfo = mService.getProxyForNetwork( mWiFiNetworkAgent.getNetwork()); final LinkProperties startedLp = mService.getLinkProperties(mWiFiNetworkAgent.getNetwork()); assertNull(mService.getLinkProperties(mCellNetworkAgent.getNetwork()).getHttpProxy()); }</code><technical_language>Nit: move this wifi network connects</technical_language>

Target:
public void testPacProxy() throws Exception { final Uri pacUrl = Uri.parse("https://pac-url"); mCellNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_CELLULAR); mCellNetworkAgent.connect(true); mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI); mWiFiNetworkAgent.connect(true); final ProxyInfo initialProxyInfo = ProxyInfo.buildPacProxy(pacUrl); final LinkProperties testLinkProperties = new LinkProperties(); testLinkProperties.setHttpProxy(initialProxyInfo); mWiFiNetworkAgent.sendLinkProperties(testLinkProperties); waitForIdle(); final ProxyInfo unstartedDefaultProxyInfo = mService.getProxyForNetwork(null); final ProxyInfo unstartedWifiProxyInfo = mService.getProxyForNetwork( mWiFiNetworkAgent.getNetwork()); final LinkProperties unstartedLp = mService.getLinkProperties(mWiFiNetworkAgent.getNetwork()); assertEquals(initialProxyInfo, unstartedDefaultProxyInfo); assertEquals(initialProxyInfo, unstartedWifiProxyInfo); assertEquals(initialProxyInfo, unstartedLp.getHttpProxy()); assertNull(mService.getLinkProperties(mCellNetworkAgent.getNetwork()).getHttpProxy()); final ProxyInfo servingProxyInfo = new ProxyInfo(pacUrl, 2097); mService.updateProxyInfo(servingProxyInfo); waitForIdle(); final ProxyInfo startedDefaultProxyInfo = mService.getProxyForNetwork(null); final ProxyInfo startedWifiProxyInfo = mService.getProxyForNetwork( mWiFiNetworkAgent.getNetwork()); final LinkProperties startedLp = mService.getLinkProperties(mWiFiNetworkAgent.getNetwork()); assertNull(mService.getLinkProperties(mCellNetworkAgent.getNetwork()).getHttpProxy()); assertNull(mService.getGlobalProxy()); }