DefaultSocks5ConnectionsRegistry implements Socks5ConnectionsRegistry { public void close(String hash) { if(pairs.containsKey(hash)) { pairs.remove(hash); } }  Socks5Pair register(String hash, IoSession session); IoSession getTarget(String hash); IoSession getRequester(String hash); boolean isActivated(String hash); boolean activate(String hash); void close(String hash);  }
@Test public void close() { DefaultSocks5ConnectionsRegistry connectionsRegistry = new DefaultSocks5ConnectionsRegistry(); connectionsRegistry.register(hash, target); connectionsRegistry.register(hash, requester); Assert.assertEquals(target, connectionsRegistry.getTarget(hash)); connectionsRegistry.close(hash); Assert.assertNull(connectionsRegistry.getTarget(hash)); }