@Test public void normalLoad() throws Exception { TestConfiguration conf = new TestConfiguration(15, 0.5); TestSystemMetrics sm = new TestSystemMetrics(); sm.addLoad(20, 0.1); TestSocketChannel member1 = createConnection("test1"); TestSocketChannel member2 = createConnection("test2"); TestSocketChannel member3 = createConnection("test3"); TestConnectionManager cm = createConnectionManager(conf, sm); cm.accept(member1, member2, member2, member3); cm.assertConnections(member1, member2, member3, member2); 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);   }