Package me.normanmaurer.niosmtp.transport

Examples of me.normanmaurer.niosmtp.transport.SMTPClientTransport


  public void lmtpTest() throws IOException
  {
    initAccount();
   
    SMTPClientTransportFactory transportFactory = NettyLMTPClientTransportFactory.createNio();
    SMTPClientTransport transport = transportFactory.createPlain();
    SMTPDeliveryAgent c = new LMTPDeliveryAgent(transport);

    SMTPDeliveryAgentConfigImpl conf = new SMTPDeliveryAgentConfigImpl();
        conf.setConnectionTimeout(2);
        conf.setResponseTimeout(2);
       
    try {
      SMTPDeliveryEnvelope transaction = new SMTPDeliveryEnvelopeImpl(
          "rustam@elasticinbox.com",
          Arrays.asList(new String[] { TEST_ACCOUNT, "nonexistent@example.com" }),
          new SMTPMessageImpl(this.getClass().getResourceAsStream(EMAIL_REGULAR)));

      SMTPClientFuture<Collection<FutureResult<Iterator<DeliveryRecipientStatus>>>> future = c
          .deliver(new InetSocketAddress(LMTP_PORT), conf, transaction);

      for(Iterator<FutureResult<Iterator<DeliveryRecipientStatus>>> i = future.get().iterator(); i.hasNext();)
      {
        FutureResult<Iterator<DeliveryRecipientStatus>> item = i.next();
        assertThat(item.isSuccess(), is(true));
      }
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ExecutionException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } finally {
      transport.destroy();
    }

    // check latest message
    String jsonResponse = given().
      pathParam("labelId", ReservedLabels.INBOX.getId()).
View Full Code Here

TOP

Related Classes of me.normanmaurer.niosmtp.transport.SMTPClientTransport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.