Search in sources :

Example 1 with Proxy

use of kong.unirest.Proxy in project target-java-sdk by adobe.

the class DefaultTargetHttpClientTest method testProxyConfigNotSet.

@Test
void testProxyConfigNotSet() {
    ClientConfig clientConfig = ClientConfig.builder().organizationId(TEST_ORG_ID).build();
    DefaultTargetHttpClient targetClient = new DefaultTargetHttpClient(clientConfig);
    UnirestInstance unirestInstance = targetClient.getUnirestInstance();
    Proxy unirestProxy = unirestInstance.config().getProxy();
    assertNull(unirestProxy);
    targetClient.close();
}
Also used : UnirestInstance(kong.unirest.UnirestInstance) Proxy(kong.unirest.Proxy) ClientConfig(com.adobe.target.edge.client.ClientConfig) Test(org.junit.jupiter.api.Test)

Example 2 with Proxy

use of kong.unirest.Proxy in project target-java-sdk by adobe.

the class DefaultTargetHttpClientTest method testProxyConfigSetWithNoAuthentication.

@Test
void testProxyConfigSetWithNoAuthentication() {
    ClientConfig clientConfig = ClientConfig.builder().organizationId(TEST_ORG_ID).proxyConfig(new ClientProxyConfig(PROXY_HOST, PROXY_PORT)).build();
    DefaultTargetHttpClient targetClient = new DefaultTargetHttpClient(clientConfig);
    UnirestInstance unirestInstance = targetClient.getUnirestInstance();
    Proxy unirestProxy = unirestInstance.config().getProxy();
    assertNotNull(unirestProxy);
    assertEquals(PROXY_HOST, unirestProxy.getHost());
    assertEquals(PROXY_PORT, unirestProxy.getPort());
    assertNull(unirestProxy.getUsername());
    assertNull(unirestProxy.getPassword());
    targetClient.close();
}
Also used : ClientProxyConfig(com.adobe.target.edge.client.ClientProxyConfig) UnirestInstance(kong.unirest.UnirestInstance) Proxy(kong.unirest.Proxy) ClientConfig(com.adobe.target.edge.client.ClientConfig) Test(org.junit.jupiter.api.Test)

Example 3 with Proxy

use of kong.unirest.Proxy in project target-java-sdk by adobe.

the class DefaultTargetHttpClientTest method testProxyConfigSetWithAuthentication.

@Test
void testProxyConfigSetWithAuthentication() {
    ClientConfig clientConfig = ClientConfig.builder().organizationId(TEST_ORG_ID).proxyConfig(new ClientProxyConfig(PROXY_HOST, PROXY_PORT, PROXY_USERNAME, PROXY_PASSWORD)).build();
    DefaultTargetHttpClient targetClient = new DefaultTargetHttpClient(clientConfig);
    UnirestInstance unirestInstance = targetClient.getUnirestInstance();
    Proxy unirestProxy = unirestInstance.config().getProxy();
    assertNotNull(unirestProxy);
    assertEquals(PROXY_HOST, unirestProxy.getHost());
    assertEquals(PROXY_PORT, unirestProxy.getPort());
    assertEquals(PROXY_USERNAME, unirestProxy.getUsername());
    assertEquals(PROXY_PASSWORD, unirestProxy.getPassword());
    targetClient.close();
}
Also used : ClientProxyConfig(com.adobe.target.edge.client.ClientProxyConfig) UnirestInstance(kong.unirest.UnirestInstance) Proxy(kong.unirest.Proxy) ClientConfig(com.adobe.target.edge.client.ClientConfig) Test(org.junit.jupiter.api.Test)

Aggregations

ClientConfig (com.adobe.target.edge.client.ClientConfig)3 Proxy (kong.unirest.Proxy)3 UnirestInstance (kong.unirest.UnirestInstance)3 Test (org.junit.jupiter.api.Test)3 ClientProxyConfig (com.adobe.target.edge.client.ClientProxyConfig)2