Search in sources :

Example 6 with TransportException

use of com.netflix.discovery.shared.transport.TransportException in project eureka by Netflix.

the class RetryableEurekaHttpClientTest method simulateTransportError.

private void simulateTransportError(int delegateFrom, int count) {
    for (int i = 0; i < count; i++) {
        int delegateId = delegateFrom + i;
        when(clientFactory.newClient(Matchers.<EurekaEndpoint>anyVararg())).thenReturn(clusterDelegates.get(delegateId));
        when(requestExecutor.execute(clusterDelegates.get(delegateId))).thenThrow(new TransportException("simulated network error"));
    }
}
Also used : TransportException(com.netflix.discovery.shared.transport.TransportException) AwsEndpoint(com.netflix.discovery.shared.resolver.aws.AwsEndpoint) EurekaEndpoint(com.netflix.discovery.shared.resolver.EurekaEndpoint)

Aggregations

TransportException (com.netflix.discovery.shared.transport.TransportException)6 EurekaEndpoint (com.netflix.discovery.shared.resolver.EurekaEndpoint)3 Test (org.junit.Test)2 DefaultEndpoint (com.netflix.discovery.shared.resolver.DefaultEndpoint)1 AwsEndpoint (com.netflix.discovery.shared.resolver.aws.AwsEndpoint)1 EurekaHttpClient (com.netflix.discovery.shared.transport.EurekaHttpClient)1 URI (java.net.URI)1 Matcher (java.util.regex.Matcher)1