Search in sources :

Example 1 with AbstractLoadBalancerAwareClient

use of com.netflix.client.AbstractLoadBalancerAwareClient in project spring-cloud-netflix by spring-cloud.

the class RibbonClientConfigurationTests method clients.

private List<AbstractLoadBalancerAwareClient> clients() {
    ArrayList<AbstractLoadBalancerAwareClient> clients = new ArrayList<>();
    clients.add(new OverrideRestClient(this.config, this.inspector));
    clients.add(new RibbonLoadBalancingHttpClient(this.config, this.inspector));
    clients.add(new OkHttpLoadBalancingClient(this.config, this.inspector));
    return clients;
}
Also used : OverrideRestClient(org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration.OverrideRestClient) AbstractLoadBalancerAwareClient(com.netflix.client.AbstractLoadBalancerAwareClient) OkHttpLoadBalancingClient(org.springframework.cloud.netflix.ribbon.okhttp.OkHttpLoadBalancingClient) RibbonLoadBalancingHttpClient(org.springframework.cloud.netflix.ribbon.apache.RibbonLoadBalancingHttpClient) ArrayList(java.util.ArrayList)

Example 2 with AbstractLoadBalancerAwareClient

use of com.netflix.client.AbstractLoadBalancerAwareClient in project spring-cloud-netflix by spring-cloud.

the class RibbonClientConfigurationTests method testNotDoubleEncodedWhenSecure.

@Test
public void testNotDoubleEncodedWhenSecure() throws Exception {
    Server server = new Server("foo", 7777);
    when(this.inspector.isSecure(server)).thenReturn(true);
    for (AbstractLoadBalancerAwareClient client : clients()) {
        URI uri = client.reconstructURIWithServer(server, new URI("http://foo/%20bar"));
        assertThat(getReason(client), uri, is(new URI("https://foo:7777/%20bar")));
    }
}
Also used : AbstractLoadBalancerAwareClient(com.netflix.client.AbstractLoadBalancerAwareClient) Server(com.netflix.loadbalancer.Server) URI(java.net.URI) Test(org.junit.Test)

Example 3 with AbstractLoadBalancerAwareClient

use of com.netflix.client.AbstractLoadBalancerAwareClient in project spring-cloud-netflix by spring-cloud.

the class RibbonClientConfigurationTests method testInSecureUriFromClientConfig.

@Test
public void testInSecureUriFromClientConfig() throws Exception {
    Server server = new Server("foo", 7777);
    when(this.inspector.isSecure(server)).thenReturn(false);
    for (AbstractLoadBalancerAwareClient client : clients()) {
        URI uri = client.reconstructURIWithServer(server, new URI("http://foo/"));
        assertThat(getReason(client), uri, is(new URI("http://foo:7777/")));
    }
}
Also used : AbstractLoadBalancerAwareClient(com.netflix.client.AbstractLoadBalancerAwareClient) Server(com.netflix.loadbalancer.Server) URI(java.net.URI) Test(org.junit.Test)

Example 4 with AbstractLoadBalancerAwareClient

use of com.netflix.client.AbstractLoadBalancerAwareClient in project spring-cloud-netflix by spring-cloud.

the class RibbonClientConfigurationTests method testSecureUriFromClientConfig.

@Test
public void testSecureUriFromClientConfig() throws Exception {
    Server server = new Server("foo", 7777);
    when(this.inspector.isSecure(server)).thenReturn(true);
    for (AbstractLoadBalancerAwareClient client : clients()) {
        URI uri = client.reconstructURIWithServer(server, new URI("http://foo/"));
        assertThat(getReason(client), uri, is(new URI("https://foo:7777/")));
    }
}
Also used : AbstractLoadBalancerAwareClient(com.netflix.client.AbstractLoadBalancerAwareClient) Server(com.netflix.loadbalancer.Server) URI(java.net.URI) Test(org.junit.Test)

Example 5 with AbstractLoadBalancerAwareClient

use of com.netflix.client.AbstractLoadBalancerAwareClient in project spring-cloud-netflix by spring-cloud.

the class RibbonClientConfigurationTests method testPlusInQueryStringGetsRewrittenWhenServerIsSecure.

@Test
public void testPlusInQueryStringGetsRewrittenWhenServerIsSecure() throws Exception {
    Server server = new Server("foo", 7777);
    when(this.inspector.isSecure(server)).thenReturn(true);
    for (AbstractLoadBalancerAwareClient client : clients()) {
        URI uri = client.reconstructURIWithServer(server, new URI("http://foo/%20bar?hello=1+2"));
        assertThat(uri, is(new URI("https://foo:7777/%20bar?hello=1%202")));
    }
}
Also used : AbstractLoadBalancerAwareClient(com.netflix.client.AbstractLoadBalancerAwareClient) Server(com.netflix.loadbalancer.Server) URI(java.net.URI) Test(org.junit.Test)

Aggregations

AbstractLoadBalancerAwareClient (com.netflix.client.AbstractLoadBalancerAwareClient)5 Server (com.netflix.loadbalancer.Server)4 URI (java.net.URI)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 OverrideRestClient (org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration.OverrideRestClient)1 RibbonLoadBalancingHttpClient (org.springframework.cloud.netflix.ribbon.apache.RibbonLoadBalancingHttpClient)1 OkHttpLoadBalancingClient (org.springframework.cloud.netflix.ribbon.okhttp.OkHttpLoadBalancingClient)1