### Question:
StorageServerChannelManager implements AutoCloseable { @Nullable public StorageServerChannel removeChannel(Endpoint endpoint, StorageServerChannel channel) { lock.readLock().lock(); try { if (closed) { log.warn("Skip removing channel {} of range server {} since the channel manager is already closed", channel, endpoint); return null; } StorageServerChannel channelRemoved; if (null == channel) { channelRemoved = channels.remove(endpoint); } else { if (channels.remove(endpoint, channel)) { channelRemoved = channel; } else { channelRemoved = null; } } if (null == channelRemoved) { log.debug("No channel associated with endpoint {} to be removed."); } else { log.info("Removed channel {} for range server {} successfully", channelRemoved, endpoint); } if (null != channelRemoved) { channelRemoved.close(); } return channelRemoved; } finally { lock.readLock().unlock(); } } StorageServerChannelManager(StorageClientSettings settings); @VisibleForTesting  StorageServerChannelManager(Function<Endpoint, StorageServerChannel> channelFactory); boolean addStorageServer(Endpoint endpoint, StorageServerChannel channel); StorageServerChannel getOrCreateChannel(Endpoint endpoint); @Nullable StorageServerChannel getChannel(Endpoint endpoint); @Nullable StorageServerChannel removeChannel(Endpoint endpoint, StorageServerChannel channel); @Override void close();  }### Answer:
@Test public void testRemoveChannel() { StorageServerChannel ch = mock(StorageServerChannel.class); assertNull(channelManager.getChannel(endpoint1)); assertTrue(channelManager.addStorageServer(endpoint1, ch)); assertTrue(ch == channelManager.getChannel(endpoint1)); assertEquals(1, channelManager.getNumChannels()); assertTrue(ch == channelManager.removeChannel(endpoint1, null)); verify(ch, times(1)).close(); assertEquals(0, channelManager.getNumChannels()); }