public synchronized void unregisterProducer(final String group, final ClientChannelInfo clientChannelInfo) {
        ConcurrentHashMap<Channel, ClientChannelInfo> channelTable = this.groupChannelTable.get(group);
        if (null != channelTable && !channelTable.isEmpty()) {
            ClientChannelInfo old = channelTable.remove(clientChannelInfo.getChannel());
            clientChannelTable.remove(clientChannelInfo.getClientId());
            if (old != null) {
                log.info("unregister a producer[{}] from groupChannelTable {}", group,
                        clientChannelInfo.toString());
                callProducerChangeListener(ProducerGroupEvent.CLIENT_UNREGISTER, group, clientChannelInfo);
            }

            if (channelTable.isEmpty()) {
                this.groupChannelTable.remove(group);
                callProducerChangeListener(ProducerGroupEvent.GROUP_UNREGISTER, group, null);
                log.info("unregister a producer group[{}] from groupChannelTable", group);
            }
        }
    }
@Test
    public void unregisterProducer() throws Exception {
        producerManager.registerProducer(group, clientInfo);
        AtomicReference<String> groupRef = new AtomicReference<>();
        AtomicReference<ClientChannelInfo> clientChannelInfoRef = new AtomicReference<>();
        producerManager.appendProducerChangeListener((event, group, clientChannelInfo) -> {
            switch (event) {
                case GROUP_UNREGISTER:
                    groupRef.set(group);
                    break;
                case CLIENT_UNREGISTER:
                    clientChannelInfoRef.set(clientChannelInfo);
                    break;
                default:
                    break;
            }
        });
        Map<Channel, ClientChannelInfo> channelMap = producerManager.getGroupChannelTable().get(group);
        assertThat(channelMap).isNotNull();
        assertThat(channelMap.get(channel)).isEqualTo(clientInfo);
        Channel channel1 = producerManager.findChannel("clientId");
        assertThat(channel1).isNotNull();
        assertThat(channel1).isEqualTo(channel);
        producerManager.unregisterProducer(group, clientInfo);
        channelMap = producerManager.getGroupChannelTable().get(group);
        channel1 = producerManager.findChannel("clientId");
        assertThat(groupRef.get()).isEqualTo(group);
        assertThat(clientChannelInfoRef.get()).isSameAs(clientInfo);
        assertThat(channelMap).isNull();
        assertThat(channel1).isNull();

    }