Socks5Pair { public synchronized IoSession getOther(IoSession session) { if(requester.equals(session)) { return target; } else { return requester; } } Socks5Pair(IoSession target, Socks5ConnectionsRegistry registry, String hash); synchronized IoSession getOther(IoSession session); synchronized IoSession getRequester(); synchronized void setRequester(IoSession requester); IoSession getTarget(); boolean isActivated(); void activate(); void close();  }
@Test public void getOther() { Socks5Pair pair = new Socks5Pair(target, connectionsRegistry, hash); pair.setRequester(requester); Assert.assertEquals(requester, pair.getOther(target)); Assert.assertEquals(target, pair.getOther(requester)); }