@Test
  public void testHttpRetryOnServerIdleTimeout() throws Exception {
    // Stop HiveServer2
    stopMiniHS2();
    HiveConf conf = getNewHiveConf();
    // Set server's idle timeout to a very low value
    conf.setVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_MAX_IDLE_TIME, "5000");
    startMiniHS2(conf, true);
    String userName = System.getProperty("user.name");
    Connection conn = getConnection(miniHS2.getJdbcURL(testDbName)+";retries=3", userName, "password");
    Statement stmt = conn.createStatement();
    stmt.execute("select from_unixtime(unix_timestamp())");
    // Sleep for longer than server's idletimeout and execute a query
    TimeUnit.SECONDS.sleep(10);
    try {
      stmt.execute("select from_unixtime(unix_timestamp())");
    } catch (Exception e) {
      fail("Not expecting exception: " + e);
    } finally {
      if (conn != null) {
        conn.close();
      }
    }
    // Restore original state
    restoreMiniHS2AndConnections();
  }
Test for jdbc driver retry on NoHttpResponseException
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java