@Test
  public void openSessionAndClose() throws Exception {
    CLIServiceClient client = miniHS2.getServiceClient();
    SessionHandle sessionHandle = client.openSession(null, null, null);
    client.closeSession(sessionHandle);
    Thread.sleep(100);

    Assert.assertEquals(Service.STATE.STARTED, miniHS2.getState());
  }
TestMiniHS2StateWithNoZookeeper.
This tests HS2 shutdown is not triggered by CloseSession operation 
while HS2 has never been registered with ZooKeeper.
itests/hive-unit/src/test/java/org/apache/hive/service/cli/thrift/TestMiniHS2StateWithNoZookeeper.java