Search in sources :

Example 1 with SocksSocketFactory

use of org.apache.hadoop.net.SocksSocketFactory in project hadoop by apache.

the class TestSocketFactory method testSocksSocketFactory.

/**
   * Test SocksSocketFactory.
   */
@Test(timeout = 5000)
public void testSocksSocketFactory() throws Exception {
    startTestServer();
    testSocketFactory(new SocksSocketFactory());
}
Also used : SocksSocketFactory(org.apache.hadoop.net.SocksSocketFactory) Test(org.junit.Test)

Example 2 with SocksSocketFactory

use of org.apache.hadoop.net.SocksSocketFactory in project hadoop by apache.

the class TestSocketFactory method testProxy.

/**
   * test proxy methods
   */
@Test(timeout = 5000)
public void testProxy() throws Exception {
    SocksSocketFactory templateWithoutProxy = new SocksSocketFactory();
    Proxy proxy = new Proxy(Type.SOCKS, InetSocketAddress.createUnresolved("localhost", 0));
    SocksSocketFactory templateWithProxy = new SocksSocketFactory(proxy);
    assertFalse(templateWithoutProxy.equals(templateWithProxy));
    Configuration configuration = new Configuration();
    configuration.set("hadoop.socks.server", "localhost:0");
    templateWithoutProxy.setConf(configuration);
    assertTrue(templateWithoutProxy.equals(templateWithProxy));
}
Also used : Proxy(java.net.Proxy) Configuration(org.apache.hadoop.conf.Configuration) SocksSocketFactory(org.apache.hadoop.net.SocksSocketFactory) Test(org.junit.Test)

Aggregations

SocksSocketFactory (org.apache.hadoop.net.SocksSocketFactory)2 Test (org.junit.Test)2 Proxy (java.net.Proxy)1 Configuration (org.apache.hadoop.conf.Configuration)1