@Test
  public void testFailureOnCryptoService() throws Exception {
    if (testEncryption) {
      setupEncryptionCast(new VerifiableProperties(new Properties()));
      instantiateEncryptionCast = false;
      cryptoService.exceptionOnEncryption.set(GSE);
      // simple blob
      requestAndResultsList.clear();
      requestAndResultsList.add(new RequestAndResult(random.nextInt(chunkSize) + 1));
      Exception expectedException = new RouterException("", GSE, RouterErrorCode.UnexpectedInternalError);
      submitPutsAndAssertFailure(expectedException, false, true, true);
      // this should not close the router.
      Assert.assertTrue("Router should not be closed", router.isOpen());
      assertCloseCleanup();

      setupEncryptionCast(new VerifiableProperties(new Properties()));
      instantiateEncryptionCast = false;
      cryptoService.exceptionOnEncryption.set(GSE);
      // composite blob
      requestAndResultsList.clear();
      requestAndResultsList.add(new RequestAndResult(chunkSize * random.nextInt(10)));
      submitPutsAndAssertFailure(expectedException, false, true, true);
      // this should not close the router.
      Assert.assertTrue("Router should not be closed", router.isOpen());
      assertCloseCleanup();
    }
  }
Tests a failure scenario where connects to server nodes throw exceptions.
ambry-router/src/test/java/com/github/ambry/router/PutManagerTest.java