@Test
  public void testTimeout() throws Exception {
    DelayedHMSHandler.testTimeoutValue = 15000;

    Database db = new DatabaseBuilder()
        .setName(dbName)
        .build(conf);
    try {
      client.createDatabase(db);
      Assert.fail("should throw timeout exception.");
    } catch (TTransportException e) {
      Assert.assertTrue("unexpected Exception", e.getMessage().contains("Read timed out"));
    }

    // restore
    DelayedHMSHandler.testTimeoutValue = -1;
  }
Test handler proxy used to simulate a long-running create_database() method
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreTimeout.java