### Question:
ProducerManager { public void unregisterProducer(final String group, final ClientChannelInfo clientChannelInfo) { try { if (this.hashcodeChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { List<ClientChannelInfo> clientChannelInfoList = this.hashcodeChannelTable.get(group.hashCode()); if (null != clientChannelInfoList && !clientChannelInfoList.isEmpty()) { boolean result = clientChannelInfoList.remove(clientChannelInfo); if (result) { log.info("unregister a producer[{}] from hashcodeChannelTable {}", group, clientChannelInfo.toString()); } if (clientChannelInfoList.isEmpty()) { this.hashcodeChannelTable.remove(group.hashCode()); log.info("unregister a producer group[{}] from hashcodeChannelTable", group); } } } finally { this.hashcodeChannelLock.unlock(); } } else { log.warn("ProducerManager unregisterProducer lock timeout"); } } catch (InterruptedException e) { log.error("", e); } try { if (this.groupChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { HashMap<Channel, ClientChannelInfo> channelTable = this.groupChannelTable.get(group); if (null != channelTable && !channelTable.isEmpty()) { ClientChannelInfo old = channelTable.remove(clientChannelInfo.getChannel()); if (old != null) { log.info("unregister a producer[{}] from groupChannelTable {}", group, clientChannelInfo.toString()); } if (channelTable.isEmpty()) { this.groupChannelTable.remove(group); log.info("unregister a producer group[{}] from groupChannelTable", group); } } } finally { this.groupChannelLock.unlock(); } } else { log.warn("ProducerManager unregisterProducer lock timeout"); } } catch (InterruptedException e) { log.error("", e); } } ProducerManager(); HashMap<String, HashMap<Channel, ClientChannelInfo>> getGroupChannelTable(); void scanNotActiveChannel(); void doChannelCloseEvent(final String remoteAddr, final Channel channel); void registerProducer(final String group, final ClientChannelInfo clientChannelInfo); void unregisterProducer(final String group, final ClientChannelInfo clientChannelInfo); ClientChannelInfo pickProducerChannelRandomly(final int producerGroupHashCode);  }### Answer:
@Test public void unregisterProducer() throws Exception { producerManager.registerProducer(group, clientInfo); HashMap<Channel, ClientChannelInfo> channelMap = producerManager.getGroupChannelTable().get(group); assertThat(channelMap).isNotNull(); assertThat(channelMap.get(channel)).isEqualTo(clientInfo); producerManager.unregisterProducer(group, clientInfo); channelMap = producerManager.getGroupChannelTable().get(group); assertThat(channelMap).isNull(); }