01: package org.jsmtpd.plugins.inputIPFilters;
02:
03: import java.net.InetAddress;
04:
05: import org.apache.commons.logging.Log;
06: import org.apache.commons.logging.LogFactory;
07: import org.jsmtpd.core.common.PluginInitException;
08: import org.jsmtpd.core.common.inputIPFilter.IFilterIP;
09:
10: /**
11: * For testing core only
12: * Do not use it !
13: * This will block the current thread during 1 minute, then drop the connection
14: */
15: public class SlowFilter implements IFilterIP {
16: private Log log = LogFactory.getLog(SlowFilter.class);
17:
18: public boolean checkIP(InetAddress input) {
19: log.debug(Thread.currentThread().getName()
20: + " sleeping for 1 min");
21: try {
22: Thread.sleep(60000);
23: } catch (InterruptedException e) {
24: log.error(e);
25: }
26: log.debug(Thread.currentThread().getName() + " resumed");
27: return false;
28: }
29:
30: public String getPluginName() {
31: return "Thread test plugin";
32: }
33:
34: public void initPlugin() throws PluginInitException {
35: }
36:
37: public void shutdownPlugin() {
38: }
39:
40: }
|