DefaultSocks5ConnectionsRegistry implements Socks5ConnectionsRegistry { public boolean activate(String hash) { Socks5Pair pair = pairs.get(hash); if(pair != null && pair.getRequester() != null) { pair.activate(); return true; } else { return false; } }  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 activate() { DefaultSocks5ConnectionsRegistry connectionsRegistry = new DefaultSocks5ConnectionsRegistry(); connectionsRegistry.register(hash, target); connectionsRegistry.register(hash, requester); Assert.assertFalse(connectionsRegistry.isActivated(hash)); Assert.assertTrue(connectionsRegistry.activate(hash)); Assert.assertTrue(connectionsRegistry.isActivated(hash)); }