@Test public void knownMembersCanConnectUnderDosAttack() throws Exception { TestConfiguration conf = new TestConfiguration(5, 1.1); TestSystemMetrics sm = new TestSystemMetrics(); sm.addLoad(7, 0.1); TestSocketChannel member1 = createConnection("test1"); TestSocketChannel member2 = createConnection("test2"); TestSocketChannel attacker1 = createConnection("attacker1"); TestSocketChannel attacker2 = createConnection("attacker2"); TestConnectionManager cm = createConnectionManager(conf, sm); cm.accept( member1, attacker1, member2, attacker1, attacker2, attacker2, member2); cm.assertConnections( member1, attacker1, member2, attacker1, member2, attacker2, attacker2); cm.assertEmpty(); }
synchronized void accept(T connection) { syncDatabase(); HostData currentPartner = getHostData(connection.getHostAddress()); currentPartner.connections.addFirst(connection); if (!activePartners.contains(currentPartner)) { activePartners.add(currentPartner); } }
AntiDosConnectionManager { synchronized void accept(T connection) { syncDatabase(); HostData currentPartner = getHostData(connection.getHostAddress()); currentPartner.connections.addFirst(connection); if (!activePartners.contains(currentPartner)) { activePartners.add(currentPartner); } } }
AntiDosConnectionManager { synchronized void accept(T connection) { syncDatabase(); HostData currentPartner = getHostData(connection.getHostAddress()); currentPartner.connections.addFirst(connection); if (!activePartners.contains(currentPartner)) { activePartners.add(currentPartner); } } AntiDosConnectionManager(AntiDosConfiguration configuration); }
AntiDosConnectionManager { synchronized void accept(T connection) { syncDatabase(); HostData currentPartner = getHostData(connection.getHostAddress()); currentPartner.connections.addFirst(connection); if (!activePartners.contains(currentPartner)) { activePartners.add(currentPartner); } } AntiDosConnectionManager(AntiDosConfiguration configuration);  }
AntiDosConnectionManager { synchronized void accept(T connection) { syncDatabase(); HostData currentPartner = getHostData(connection.getHostAddress()); currentPartner.connections.addFirst(connection); if (!activePartners.contains(currentPartner)) { activePartners.add(currentPartner); } } AntiDosConnectionManager(AntiDosConfiguration configuration);   }