public void pauseCnxn(final long ms) {
    final Thread t = new Thread() {
      @Override
      public void run() {
        try {
          final ClientCnxn cnxn = getConnection();
          synchronized (cnxn) {
            try {
              final Field sendThreadFld = cnxn.getClass().getDeclaredField("sendThread");
              sendThreadFld.setAccessible(true);
              Object sendThread = sendThreadFld.get(cnxn);
              if (sendThread != null) {
                Method method = sendThread.getClass().getDeclaredMethod("testableCloseSocket");
                method.setAccessible(true);
                try {
                  method.invoke(sendThread);
                } catch (InvocationTargetException e) {
                  // is fine
                }
              }
            } catch (Exception e) {
              throw new RuntimeException("Closing Zookeeper send channel failed.", e);
            }
            Thread.sleep(ms);
          }
        } catch (InterruptedException e) {
          // ignore
        } finally {
          spawnedThreads.remove(this);
        }
      }
    };
    spawnedThreads.add(t);
    t.start();
  }