### Question:
HighAvailabilitySlaves implements Lifecycle, Slaves { @Override public void shutdown() { cluster.removeClusterListener( clusterListener ); life.shutdown(); slaves.clear(); } HighAvailabilitySlaves( ClusterMembers clusterMembers, Cluster cluster, SlaveFactory slaveFactory,
            HostnamePort me ); @Override Iterable<Slave> getSlaves(); @Override void init(); @Override void start(); @Override void stop(); @Override void shutdown();  }### Answer:
@Test public void shouldSupportConcurrentConsumptionOfSlaves() throws Exception { LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>(); HighAvailabilitySlaves haSlaves = new HighAvailabilitySlaves( clusterMembersOfSize( 1000 ), mock( Cluster.class ), new DefaultSlaveFactory( NullLogProvider.getInstance(), new Monitors(), 42, Suppliers.singleton( logEntryReader ) ), new HostnamePort( null, 0 ) ); ExecutorService executor = Executors.newFixedThreadPool( 5 ); for ( int i = 0; i < 5; i++ ) { executor.submit( slavesConsumingRunnable( haSlaves ) ); } executor.shutdown(); executor.awaitTermination( 30, SECONDS ); int slavesCount = 0; LifeSupport life = ReflectionUtil.getPrivateField( haSlaves, "life", LifeSupport.class ); for ( Lifecycle lifecycle : life.getLifecycleInstances() ) { if ( lifecycle instanceof Slave ) { slavesCount++; } } assertEquals( "Unexpected number of slaves", 1000 - 1, slavesCount ); }