void () { MavenServerConnector connector = MavenServerManager.getInstance().getConnector(myProject, myProjectRoot.getPath()); ensureConnected(connector); ScheduledExecutorService executor = ReflectionUtil.getField(MavenServerConnectorImpl.class, connector, ScheduledExecutorService.class, "myExecutor"); kill(connector); new WaitFor(1_000) { @Override protected boolean condition() { return executor.isShutdown(); } }; assertTrue(executor.isShutdown()); }