code: public static boolean isEndState(TraceEvent te)
     {
        if (te.getType() == TraceEvent.RETURN_CONNECTION_LISTENER ||
            te.getType() == TraceEvent.RETURN_CONNECTION_LISTENER_WITH_KILL ||
            te.getType() == TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER ||
            te.getType() == TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL ||
            te.getType() == TraceEvent.CLEAR_CONNECTION_LISTENER)
           return true;
  
        return false;
     }
docs: Is end state
  @param te The event
  @return The value