Tabnine Logo
InMemoryDNSService.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.james.dnsservice.api.InMemoryDNSService
constructor

Best Java code snippets using org.apache.james.dnsservice.api.InMemoryDNSService.<init> (Showing top 4 results out of 315)

origin: org.apache.james/james-server-data-library

/**
 * Return a fake DNSServer.
 */
protected DNSService getDNSServer(final String hostName) throws UnknownHostException {
  return new InMemoryDNSService()
    .registerMxRecord(hostName, "127.0.0.1")
    .registerMxRecord("127.0.0.1", "127.0.0.1");
}
origin: org.apache.james/james-server-protocols-smtp

  @Test
  public void testRejectLoopbackMX() throws Exception {
    String bannedAddress = "172.53.64.2";

    DNSService dns = new InMemoryDNSService()
      .registerMxRecord(INVALID_HOST, bannedAddress)
      .registerMxRecord("255.255.255.255", "255.255.255.255")
      .registerMxRecord(bannedAddress, bannedAddress);
    MailAddress mailAddress = new MailAddress("test@" + INVALID_HOST);
    SMTPSession session = setupMockedSMTPSession(mailAddress);

    ValidRcptMX handler = new ValidRcptMX();
    handler.setDNSService(dns);
    handler.setBannedNetworks(ImmutableList.of(bannedAddress), dns);
    HookReturnCode rCode = handler.doRcpt(session, null, mailAddress).getResult();

    assertThat(HookReturnCode.deny()).describedAs("Reject").isEqualTo(rCode);
  }
}
origin: org.apache.james/james-server-mailets

@Before
public void setup() throws Exception {
  DNSService dnsServer = new InMemoryDNSService()
    .registerMxRecord("192.168.0.1", "192.168.0.1")
    .registerMxRecord("192.168.200.1", "192.168.200.1")
    .registerMxRecord("192.168.200.0", "192.168.200.0")
    .registerMxRecord("255.255.255.0", "255.255.255.0");
  matcherConfig = FakeMatcherConfig.builder()
      .matcherName("AllowedNetworkIs")
      .condition("192.168.200.0/24")
      .build();
  matcher = new RemoteAddrNotInNetwork();
  matcher.setDNSService(dnsServer);
  matcher.init(matcherConfig);
  testRecipient = new MailAddress("test@james.apache.org");
}
origin: org.apache.james/james-server-mailets

@Before
public void setup() throws Exception {
  DNSService dnsServer = new InMemoryDNSService()
    .registerMxRecord("192.168.0.1", "192.168.0.1")
    .registerMxRecord("192.168.200.1", "192.168.200.1")
    .registerMxRecord("192.168.200.0", "192.168.200.0")
    .registerMxRecord("255.255.255.0", "255.255.255.0");
  FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
      .matcherName("AllowedNetworkIs")
      .condition("192.168.200.0/24")
      .build();
  matcher = new RemoteAddrInNetwork();
  matcher.setDNSService(dnsServer);
  matcher.init(matcherConfig);
  testRecipient = new MailAddress("test@james.apache.org");
}
org.apache.james.dnsservice.apiInMemoryDNSService<init>

Popular methods of InMemoryDNSService

  • registerMxRecord
  • dnsRecordFor
  • getDNSEntry
  • hostRecord
  • registerRecord

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • runOnUiThread (Activity)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Option (scala)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now