Merge pull request #377 from jerry-sc/monitor-bug
fix the monitor bug which the spider will terminate when a seed url with portpull/395/merge
commit
1491033534
@ -0,0 +1,35 @@
|
||||
package us.codecraft.webmagic.monitor;
|
||||
|
||||
import org.junit.Test;
|
||||
import us.codecraft.webmagic.Page;
|
||||
import us.codecraft.webmagic.Site;
|
||||
import us.codecraft.webmagic.Spider;
|
||||
import us.codecraft.webmagic.processor.PageProcessor;
|
||||
|
||||
import javax.management.JMException;
|
||||
|
||||
/**
|
||||
* @author jerry_shenchao@163.com
|
||||
*/
|
||||
public class SeedUrlWithPortTest {
|
||||
|
||||
@Test
|
||||
public void testSeedUrlWithPort() throws JMException {
|
||||
Spider spider = Spider.create(new TempProcessor()).addUrl("http://www.hndpf.org:8889/");
|
||||
SpiderMonitor.instance().register(spider);
|
||||
spider.run();
|
||||
}
|
||||
}
|
||||
|
||||
class TempProcessor implements PageProcessor {
|
||||
|
||||
@Override
|
||||
public void process(Page page) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Site getSite() {
|
||||
return Site.me();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue