private void testSSLHMS(boolean useDefaultStoreType) throws Exception {
    SSLTestUtils.setMetastoreSslConf(conf);
    SSLTestUtils.setSslConfOverlay(confOverlay);
    // Test in binary mode
    SSLTestUtils.setBinaryConfOverlay(confOverlay);
    if (!useDefaultStoreType) {
      confOverlay.put(ConfVars.HIVE_SERVER2_SSL_KEYSTORE_TYPE.varname, KEY_STORE_TRUST_STORE_TYPE);
      MetastoreConf.setVar(conf, MetastoreConf.ConfVars.SSL_KEYSTORE_TYPE, KEY_STORE_TRUST_STORE_TYPE);
    }
    //MetastoreConf.setBoolVar(conf, MetastoreConf.ConfVars.EVENT_DB_NOTIFICATION_API_AUTH, false);
    // Test in http mode
    SSLTestUtils.setHttpConfOverlay(confOverlay);
    miniHS2 = new MiniHS2.Builder().withRemoteMetastore().withConf(conf).cleanupLocalDirOnStartup(false).build();
    miniHS2.start(confOverlay);

    String tableName = "sslTab";
    Path dataFilePath = new Path(dataFileDir, "kv1.txt");

    // make SSL connection
    hs2Conn = DriverManager.getConnection(miniHS2.getJdbcURL("default", SSLTestUtils.SSL_CONN_PARAMS),
            System.getProperty("user.name"), "bar");

    // Set up test data
    SSLTestUtils.setupTestTableWithData(tableName, dataFilePath, hs2Conn);
    Statement stmt = hs2Conn.createStatement();
    ResultSet res = stmt.executeQuery("SELECT * FROM " + tableName);
    int rowCount = 0;
    while (res.next()) {
      ++rowCount;
      assertEquals("val_" + res.getInt(1), res.getString(2));
    }
    // read result over SSL
    assertEquals(500, rowCount);

    hs2Conn.close();
  }
Test HMS server with SSL with input keystore type
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java