@Test
  public void testMonitorDeadlock() throws Exception {
    final Object lock1 = new Object();
    final Object lock2 = new Object();

    Thread thread1 = new Thread() {
      @Override
      public void run() {
        stuckThreads.add(Thread.currentThread());

        synchronized (lock1) {
          Thread thread2 = new Thread() {
            @Override
            public void run() {
              stuckThreads.add(Thread.currentThread());
              synchronized (lock2) {
                synchronized (lock1) {
                  System.out.println("we won't get here");
                }
              }
            }
          };

          thread2.start();

          try {
            Thread.sleep(1000);
            synchronized (lock2) {
              System.out.println("We won't get here");
            }
          } catch (InterruptedException ignore) {
          }
        }
      }
    };

    thread1.start();

    Thread.sleep(2000);

    DeadlockDetector detector = new DeadlockDetector();
    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
    LinkedList<Dependency> deadlocks = detector.findDeadlock();

    System.out.println("deadlocks=" + DeadlockDetector.prettyFormat(deadlocks));

    assertEquals(4, detector.findDeadlock().size());
  }
must be IntegrationTest because: "we can't clean up the threads deadlocked on monitors"
geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/deadlock/DeadlockDetectorIntegrationTest.java