@Override
    protected void doStop() throws Exception {
        if (connection != null) {
            for (IrcChannel channel : getEndpoint().getConfiguration().getChannelList()) {
                LOG.debug("Parting: {}", channel);
                connection.doPart(channel.getName());
            }
            connection.removeIRCEventListener(listener);
        }
        super.doStop();
    }
@Test
    public void doStopTest() {
        producer.stop();
        verify(connection).doPart("#chan1");
        verify(connection).doPart("#chan2");
        verify(connection).removeIRCEventListener(listener);
    }