@Test public void testInBlackList() throws MessagingException { Mail mail = createMail(LISTED_HOST.toString()); setupMatcher(BLACKLIST); Collection<MailAddress> matchedRecipients = matcher.match(mail); assertThat(matchedRecipients).isNotNull(); assertThat(matchedRecipients.size()).isEqualTo(mail.getRecipients().size()); }
@Override public Collection<MailAddress> match(Mail mail) { String host = mail.getRemoteAddr(); try { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(host, " .", false); while (st.hasMoreTokens()) { sb.insert(0, st.nextToken() + "."); } sb.append(network); dnsServer.getByName(sb.toString()); return mail.getRecipients(); } catch (UnknownHostException uhe) { return null; } }
InSpammerBlacklist extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { String host = mail.getRemoteAddr(); try { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(host, " .", false); while (st.hasMoreTokens()) { sb.insert(0, st.nextToken() + "."); } sb.append(network); dnsServer.getByName(sb.toString()); return mail.getRecipients(); } catch (UnknownHostException uhe) { return null; } } }
InSpammerBlacklist extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { String host = mail.getRemoteAddr(); try { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(host, " .", false); while (st.hasMoreTokens()) { sb.insert(0, st.nextToken() + "."); } sb.append(network); dnsServer.getByName(sb.toString()); return mail.getRecipients(); } catch (UnknownHostException uhe) { return null; } }  }
InSpammerBlacklist extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { String host = mail.getRemoteAddr(); try { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(host, " .", false); while (st.hasMoreTokens()) { sb.insert(0, st.nextToken() + "."); } sb.append(network); dnsServer.getByName(sb.toString()); return mail.getRecipients(); } catch (UnknownHostException uhe) { return null; } }  @Inject void setDNSService(DNSService dnsService); @Override void init(); @Override Collection<MailAddress> match(Mail mail); }
InSpammerBlacklist extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { String host = mail.getRemoteAddr(); try { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(host, " .", false); while (st.hasMoreTokens()) { sb.insert(0, st.nextToken() + "."); } sb.append(network); dnsServer.getByName(sb.toString()); return mail.getRecipients(); } catch (UnknownHostException uhe) { return null; } }  @Inject void setDNSService(DNSService dnsService); @Override void init(); @Override Collection<MailAddress> match(Mail mail);  }