MaxbandwidthFilter extends Filter { public void process(ScoreChart scorechart, User user, InetAddress peer, char direction, InodeHandleInterface dir, RemoteSlave sourceSlave) throws NoAvailableSlaveException { for (Iterator<ScoreChart.SlaveScore> iter = scorechart.getSlaveScores().iterator(); iter .hasNext(); ) { ScoreChart.SlaveScore slavescore = iter.next(); SlaveStatus status; try { status = slavescore.getRSlave().getSlaveStatusAvailable(); } catch (SlaveUnavailableException e) { iter.remove(); continue; } if (status.getThroughputDirection(direction) > _maxBandwidth) { iter.remove(); } } } MaxbandwidthFilter(int i, Properties p); void process(ScoreChart scorechart, User user, InetAddress peer,
                        char direction, InodeHandleInterface dir, RemoteSlave sourceSlave);  }
@Test public void testSimple() throws NoAvailableSlaveException { Properties p = new Properties(); p.put("1.maxbandwidth", "800kb"); Filter f = new MaxbandwidthFilter(1, p); ScoreChart sc = new ScoreChart(Arrays.asList(rslaves)); f.process(sc, null, null, Transfer.TRANSFER_SENDING_DOWNLOAD, new DirectoryHandle("/"), null); assertEquals(sc.getBestSlave(), rslaves[1]); }