final CountDownLatch latch = new CountDownLatch(2);
final UninstallListener connectionListener = new UninstallListener(latch, HostControllerConnectionService.SERVICE_NAME);
final UninstallListener clientListener = new UninstallListener(latch, HostControllerServerClient.SERVICE_NAME);
//Disconnect from the old HC
final ServiceContainer container = containerFuture.get();
final ServiceController<?> client = container.getRequiredService(HostControllerServerClient.SERVICE_NAME);
final String name = ((HostControllerServerClient)client.getValue()).getServerName();
final String processName = ((HostControllerServerClient)client.getValue()).getServerProcessName();
client.addListener(clientListener);
client.setMode(ServiceController.Mode.REMOVE);
final ServiceController<?> connection = container.getRequiredService(HostControllerConnectionService.SERVICE_NAME);
connection.addListener(connectionListener);
connection.setMode(ServiceController.Mode.REMOVE);
latch.await();