DefaultSocks5ConnectionsRegistry implements Socks5ConnectionsRegistry { public Socks5Pair register(String hash, IoSession session) { Socks5Pair pair = pairs.get(hash); if(pair == null) { pair = new Socks5Pair(session, this, hash); pairs.put(hash, pair); } else { pair.setRequester(session); } return pair; }  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 register() { DefaultSocks5ConnectionsRegistry connectionsRegistry = new DefaultSocks5ConnectionsRegistry(); connectionsRegistry.register(hash, target); Assert.assertEquals(target, connectionsRegistry.getTarget(hash)); Assert.assertNull(connectionsRegistry.getRequester(hash)); }