@Override public boolean isOpen() { return this.target != null && this.target.isOpen(); }
@Override public boolean isOpen() { return this.target != null && this.target.isOpen(); }
@Override public boolean isOpen() { return target != null && target.isOpen(); }
@Override public boolean isConnected() { return getConnection() != null && getConnection().isOpen(); }
private ConnectionFactory mockCF(final String address, final CountDownLatch latch) throws Exception { ConnectionFactory connectionFactory = mock(ConnectionFactory.class); Connection connection = mock(Connection.class); Channel channel = mock(Channel.class); when(connectionFactory.createConnection()).thenReturn(connection); when(connection.createChannel(false)).thenReturn(channel); when(connection.isOpen()).thenReturn(true, false); when(channel.isOpen()).thenReturn(true, false); doAnswer(invocation -> { String tag = UUID.randomUUID().toString(); consumers.put(address, invocation.getArgument(6)); consumerTags.put(address, tag); if (latch != null) { latch.countDown(); } return tag; }).when(channel).basicConsume(anyString(), anyBoolean(), anyString(), anyBoolean(), anyBoolean(), anyMap(), any(Consumer.class)); when(connectionFactory.getHost()).thenReturn(address); this.channels.put(address, channel); return connectionFactory; }
given(connectionFactory.createConnection()).willReturn(connection); given(connection.createChannel(false)).willReturn(channel); given(connection.isOpen()).willReturn(true); given(channel.isOpen()).willReturn(true); final AtomicInteger n = new AtomicInteger();
Connection connection = mock(Connection.class); Channel channel = mock(Channel.class); given(connection.isOpen()).willReturn(true); given(mockCF.createConnection()).willReturn(connection); given(connection.createChannel(false)).willReturn(channel);
Connection connection = mock(Connection.class); Channel channel = mock(Channel.class); given(connection.isOpen()).willReturn(true); given(mockCF.createConnection()).willReturn(connection); given(connection.createChannel(false)).willReturn(channel);