Source:
<code>public void testCompeteLeadership() throws Exception { final int managerCount = 3; String className = getShortClassName(); final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + "testCompeteLeadership"; final ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient)); final PropertyKey.Builder keyBuilder = accessor.keyBuilder(); TestHelper.setupEmptyCluster(_gZkClient, clusterName); final Map<String, ZKHelixManager> managerList = new HashMap<>(); final List<GenericHelixController> controllers = new ArrayList<>(); for (int i = 0; i < managerCount; i++) { String controllerName = "controller_" + i; ZKHelixManager manager = new ZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER, ZK_ADDR); GenericHelixController controller0 = new GenericHelixController(); DistributedLeaderElection election = new DistributedLeaderElection(manager, controller0, Collections.EMPTY_LIST); controllers.add(controller0); manager.connect(); managerList.put(manager.getInstanceName(), manager); } try { while (!managerList.isEmpty()) { Assert.assertTrue(TestHelper.verify(new TestHelper.Verifier() { @Override public boolean verify() { LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader()); if (liveInstance != null) { managerList.remove(liveInstance.getInstanceName()).disconnect(); return true; } else { return false; } } }, 1000)); } } finally { for (GenericHelixController controller : controllers) { <START> controller.shutdown(); <END> } TestHelper.dropCluster(clusterName, _gZkClient); } }</code><technical_language>managers? Please disconnect too</technical_language>

Target:
public void testCompeteLeadership() throws Exception { final int managerCount = 3; String className = getShortClassName(); final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + "testCompeteLeadership"; final ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(_gZkClient)); final PropertyKey.Builder keyBuilder = accessor.keyBuilder(); TestHelper.setupEmptyCluster(_gZkClient, clusterName); final Map<String, ZKHelixManager> managerList = new HashMap<>(); final List<GenericHelixController> controllers = new ArrayList<>(); for (int i = 0; i < managerCount; i++) { String controllerName = "controller_" + i; ZKHelixManager manager = new ZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER, ZK_ADDR); GenericHelixController controller0 = new GenericHelixController(); DistributedLeaderElection election = new DistributedLeaderElection(manager, controller0, Collections.EMPTY_LIST); controllers.add(controller0); manager.connect(); managerList.put(manager.getInstanceName(), manager); } try { while (!managerList.isEmpty()) { Assert.assertTrue(TestHelper.verify(new TestHelper.Verifier() { @Override public boolean verify() { LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader()); if (liveInstance != null) { managerList.remove(liveInstance.getInstanceName()).disconnect(); return true; } else { return false; } } }, 1000)); } } finally { for (GenericHelixController controller : controllers) { controller.shutdown(); } for (ZKHelixManager mgr: managerList.values()) { mgr.disconnect(); } TestHelper.dropCluster(clusterName, _gZkClient); } }