### Question:
CatchUpChannelPool { CHANNEL acquire( AdvertisedSocketAddress catchUpAddress ) throws Exception { CHANNEL channel = getIdleChannel( catchUpAddress ); if ( channel == null ) { channel = factory.apply( catchUpAddress ); try { channel.connect(); assertActive( channel, catchUpAddress ); } catch ( Exception e ) { channel.close(); throw e; } } addActiveChannel( channel ); return channel; } CatchUpChannelPool( Function<AdvertisedSocketAddress,CHANNEL> factory );   }### Answer:
@Test public void shouldCreateANewChannelIfFirstChannelIsStillActive() throws Exception { CatchUpChannelPool<TestChannel> pool = new CatchUpChannelPool<>( TestChannel::new ); TestChannel channelA = pool.acquire( localAddress( 1 ) ); TestChannel channelB = pool.acquire( localAddress( 1 ) ); assertNotSame( channelA, channelB ); }
@Test public void shouldFailWithExceptionIsChannelIsNotActive() { CatchUpChannelPool<TestChannel> pool = new CatchUpChannelPool<>( advertisedSocketAddress -> new TestChannel( advertisedSocketAddress, false ) ); try { pool.acquire( localAddress( 1 ) ); } catch ( Exception e ) { assertEquals( ConnectException.class, e.getClass() ); assertEquals( "Unable to connect to localhost:1", e.getMessage() ); return; } fail(); }