@Override
      public X509TestContext load(CacheKey key) throws Exception {
        return X509TestContext.newBuilder(conf).setTempDir(tempDir)
          .setKeyStorePassword(key.keyPassword).setKeyStoreKeyType(key.certKeyType)
          .setTrustStorePassword(key.keyPassword).setTrustStoreKeyType(key.caKeyType).build();
      }
Will cache X509TestContext to speed up tests.
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestContextProvider.java