org.subethamail.smtp.TooMuchDataException Java Examples

The following examples show how to use org.subethamail.smtp.TooMuchDataException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RejectLargeMailTest.java    From mireka with Apache License 2.0 5 votes vote down vote up
@Test
public void testSmallMail() throws TooMuchDataException,
        RejectExceptionExt, IOException {
    filter.data(ExampleMailData.simple());

    verify(chain).data(exampleSimpleMail());
}
 
Example #2
Source File: RejectLargeMailTest.java    From mireka with Apache License 2.0 5 votes vote down vote up
@Test(expected = TooMuchDataException.class)
public void testLargeMail() throws TooMuchDataException,
        RejectExceptionExt, IOException {
    filter.data(ExampleMailData.mail4k());

    ArgumentCaptor<MailData> producedMailDataArgument =
            ArgumentCaptor.forClass(MailData.class);
    verify(chain).data(producedMailDataArgument.capture());
    MailData producedMailData = producedMailDataArgument.getValue();
    byte[] buffer = new byte[5000]; // larger then allowed
    producedMailData.getInputStream().read(buffer);
}
 
Example #3
Source File: StopLoopTest.java    From mireka with Apache License 2.0 5 votes vote down vote up
@Test(expected = RejectException.class)
public void testLoopingData() throws TooMuchDataException, RejectException,
        IOException {
    StopLoop stopLoop = new StopLoop();
    stopLoop.setMaxReceivedHeaders(2);
    MailData bouncedMail =
            ExampleMailData.fromResource(getClass(), "looping.eml");
    stopLoop.data(bouncedMail);
}
 
Example #4
Source File: StopLoopTest.java    From mireka with Apache License 2.0 5 votes vote down vote up
@Test
public void testNotLoopingData() throws TooMuchDataException,
        RejectException, IOException {
    StopLoop stopLoop = new StopLoop();
    stopLoop.setMaxReceivedHeaders(2);
    stopLoop.data(ExampleMailData.simple());
}
 
Example #5
Source File: RejectLargeMail.java    From mireka with Apache License 2.0 4 votes vote down vote up
@Override
protected void thresholdReached(int current) throws IOException {
    throw new TooMuchDataException();
}
 
Example #6
Source File: SmarterMessageListener.java    From subethasmtp with Apache License 2.0 2 votes vote down vote up
/**
 * When message data arrives, this method will be called for every recipient
 * this listener accepted.
 *
 * @param data will be the smtp data stream, stripped of any extra '.' chars.  The
 * 			data stream is only valid for the duration of this call.
 *
 * @throws TooMuchDataException if the listener can't handle that much data.
 *         An error will be reported to the client.
 * @throws IOException if there is an IO error reading the input data.
 */
public void deliver(InputStream data) throws TooMuchDataException, IOException;
 
Example #7
Source File: SimpleMessageListener.java    From subethasmtp with Apache License 2.0 2 votes vote down vote up
/**
 * When message data arrives, this method will be called for every recipient
 * this listener accepted.
 *
 * @param from is the envelope sender in rfc822 form
 * @param recipient will be an accepted recipient in rfc822 form
 * @param data will be the smtp data stream, stripped of any extra '.' chars.  The
 * 			data stream is only valid for the duration of this call.
 *
 * @throws TooMuchDataException if the listener can't handle that much data.
 *         An error will be reported to the client.
 * @throws IOException if there is an IO error reading the input data.
 */
public void deliver(String from, String recipient, InputStream data)
		throws TooMuchDataException, IOException;