@Test
	public void testKillOneContainer() throws Exception {
		for (int i = 0; i < 3; i++) {
			startContainer();
		}

		SpringXDTemplate template = ensureTemplate();
		logger.info("Waiting for containers...");
		Map<Long, String> mapPidUuid = waitForContainers();
		logger.info("Containers running");

		String streamName = testName.getMethodName() + "-ticktock";

		template.streamOperations().createStream(streamName, "time|log", false);
		verifyStreamCreated(streamName);

		template.streamOperations().deploy(streamName, Collections.<String, String> emptyMap());
		verifyStreamDeployed(streamName);

		ModuleRuntimeContainers moduleContainers = retrieveModuleRuntimeContainers(streamName);

		// kill the source
		long pidToKill = 0;
		for (Map.Entry<Long, String> entry : mapPidUuid.entrySet()) {
			if (moduleContainers.getSourceContainers().contains(entry.getValue())) {
				pidToKill = entry.getKey();
				break;
			}
		}
		assertFalse(pidToKill == 0);
		logger.info("Killing container with pid {}", pidToKill);
		shutdownContainer(pidToKill);

		verifyStreamDeployed(streamName);

		// ensure the module is picked up by another server
		ModuleRuntimeContainers redeployedModuleContainers = retrieveModuleRuntimeContainers(streamName);
		logger.debug("old source containers:{}, new source containers: {}",
				moduleContainers.getSourceContainers(),
				redeployedModuleContainers.getSourceContainers());

		assertNotEquals(moduleContainers.getSourceContainers(),
				redeployedModuleContainers.getSourceContainers());

	}
Start three containers and deploy a simple two module stream.
Kill the container hosting the source module and assert that
the module is deployed to one of the remaining containers.

@throws Exception
spring-xd-distributed-test/src/test/java/org/springframework/xd/distributed/test/StreamDeploymentTests.java