@Test
public void testHedgingWhenBothFail() throws Exception {

  ClientProtocol badMock = Mockito.mock(ClientProtocol.class);
  Mockito.when(badMock.getStats()).thenThrow(new IOException("Bad mock !!"));
  ClientProtocol worseMock = Mockito.mock(ClientProtocol.class);
  Mockito.when(worseMock.getStats()).thenThrow(
          new IOException("Worse mock !!"));
  RequestHedgingProxyProvider<ClientProtocol> provider =
      new RequestHedgingProxyProvider<>(conf, nnUri, ClientProtocol.class,
          createFactory(badMock, worseMock));
  try {
    provider.getProxy().proxy.getStats();
    Assert.fail("Should fail since both namenodes throw IOException !!");
  } catch (Exception e) {
    Assert.assertTrue(e instanceof MultiException);
  }
  Mockito.verify(badMock).getStats();
  Mockito.verify(worseMock).getStats();
}