@@ -0,0 +1,2559 @@
+/*%0A * Copyright 2000-2017 JetBrains s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.intellij.openapi.network;%0A%0Aimport com.intellij.util.net.HttpConfigurable;%0Aimport com.intellij.util.net.IdeaWideProxySelector;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.net.InetSocketAddress;%0Aimport java.net.Proxy;%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0Aimport java.util.List;%0A%0A/**%0A * Created with IntelliJ IDEA.%0A * User: Irina.Chernushina%0A * Date: 3/26/13%0A * Time: 4:50 PM%0A */%0Apublic class ProxyExceptionsTest %7B%0A  private HttpConfigurable myConfigurable;%0A  private IdeaWideProxySelector mySelector;%0A%0A  @Before%0A  public void setUp() %7B%0A    myConfigurable = new HttpConfigurable();%0A    myConfigurable.USE_HTTP_PROXY = true;%0A    myConfigurable.PROXY_TYPE_IS_SOCKS = false;%0A    myConfigurable.PROXY_HOST = %22proxy%22;%0A    myConfigurable.PROXY_PORT = 1234;%0A%0A    mySelector = new IdeaWideProxySelector(myConfigurable);%0A  %7D%0A%0A  @Test%0A  public void testSimple() throws Exception %7B%0A    //65.55.58.201%0A    myConfigurable.PROXY_EXCEPTIONS = %22*.myhost.com, 65.55.58.*%22;%0A%0A    assertProxied(%22http://myhost.com%22);%0A    assertDirect(%22http://somewhere.myhost.com/inner/url%22);%0A    assertDirect(%22https://somewhere.myhost.com:4567/inner/url%22);%0A    assertDirect(%22http://65.55.58.201:4567/inner/url%22);%0A%0A    assertProxied(%22http://65.55.59.201:4567/inner/url%22);%0A    assertProxied(%22http://jetbrains.com%22);%0A  %7D%0A%0A  private void assertDirect(final String s) throws URISyntaxException %7B%0A    List%3CProxy%3E proxies = mySelector.select(new URI(s));%0A    Assert.assertTrue(proxies.size() == 1);%0A    Assert.assertEquals(Proxy.Type.DIRECT, proxies.get(0).type());%0A  %7D%0A%0A  private void assertProxied(final String s) throws URISyntaxException %7B%0A    List%3CProxy%3E proxies = mySelector.select(new URI(s));%0A    Assert.assertTrue(proxies.size() == 1);%0A    Assert.assertEquals(Proxy.Type.HTTP, proxies.get(0).type());%0A    Assert.assertEquals(myConfigurable.PROXY_HOST, ((InetSocketAddress) proxies.get(0).address()).getHostName());%0A  %7D%0A%7D%0A

move ProxyExceptionsTest