use of org.apache.hadoop.net.ConnectTimeoutException in project hadoop by apache.
the class TestIPC method assertRetriesOnSocketTimeouts.
private void assertRetriesOnSocketTimeouts(Configuration conf, int maxTimeoutRetries) throws IOException {
SocketFactory mockFactory = Mockito.mock(SocketFactory.class);
doThrow(new ConnectTimeoutException("fake")).when(mockFactory).createSocket();
Client client = new Client(LongWritable.class, conf, mockFactory);
InetSocketAddress address = new InetSocketAddress("127.0.0.1", 9090);
try {
call(client, RANDOM.nextLong(), address, conf);
fail("Not throwing the SocketTimeoutException");
} catch (SocketTimeoutException e) {
Mockito.verify(mockFactory, Mockito.times(maxTimeoutRetries)).createSocket();
}
client.stop();
}
Aggregations