protected void shutdownHeartbeat( ExecutorService heartbeat ) {

    if ( heartbeat != null ) {

      try {
        heartbeat.shutdownNow(); // prevents waiting tasks from starting and attempts to stop currently executing ones

      } catch ( Throwable t ) {
        /* do nothing */
      }
    }
  }
@Test
  public void testShutdownHeartbeat_success() throws Exception {
    doCallRealMethod().when( trans ).shutdownHeartbeat( any( ExecutorService.class ) );
    ExecutorService executorService = mock( ExecutorService.class );
    doReturn( null ).when( executorService ).shutdownNow();

    trans.shutdownHeartbeat( executorService );

    verify( executorService, times ( 1 ) ).shutdownNow();
  }