@Override
  public ByteBuffer encrypt(ByteBuffer toEncrypt, SecretKeySpec key) throws GeneralSecurityException {
    if (exceptionOnEncryption.get() != null) {
      throw exceptionOnEncryption.get();
    }
    return super.encrypt(toEncrypt, key);
  }
MockCryptoService to assist in testing exception cases
ambry-router/src/test/java/com/github/ambry/router/MockCryptoService.java