| 1 |
package com.github.markusbernhardt.proxy.selector.fixed; |
| 2 |
|
| 3 |
import static org.junit.Assert.assertEquals; |
| 4 |
|
| 5 |
import java.net.Proxy; |
| 6 |
import java.net.ProxySelector; |
| 7 |
import java.util.List; |
| 8 |
|
| 9 |
import org.junit.Test; |
| 10 |
|
| 11 |
import com.github.markusbernhardt.proxy.TestUtil; |
| 12 |
import com.github.markusbernhardt.proxy.selector.fixed.FixedProxySelector; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public class FixedProxyTest { |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
@Test |
| 26 |
public void testFixedProxy() { |
| 27 |
ProxySelector ps = new FixedProxySelector("http_proxy.unit-test.invalid", 8090); |
| 28 |
|
| 29 |
List<Proxy> result = ps.select(TestUtil.HTTP_TEST_URI); |
| 30 |
assertEquals(TestUtil.HTTP_TEST_PROXY, result.get(0)); |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
@Test |
| 37 |
public void testFixedProxy2() { |
| 38 |
ProxySelector ps = new FixedProxySelector(TestUtil.HTTP_TEST_PROXY); |
| 39 |
|
| 40 |
List<Proxy> result = ps.select(TestUtil.HTTP_TEST_URI); |
| 41 |
assertEquals(TestUtil.HTTP_TEST_PROXY, result.get(0)); |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
@Test |
| 48 |
public void testFixedProxy3() { |
| 49 |
ProxySelector ps = new FixedProxySelector(TestUtil.HTTP_TEST_PROXY); |
| 50 |
|
| 51 |
List<Proxy> result = ps.select(TestUtil.HTTPS_TEST_URI); |
| 52 |
assertEquals(TestUtil.HTTP_TEST_PROXY, result.get(0)); |
| 53 |
} |
| 54 |
|
| 55 |
} |