Package org.subethamail.smtp.io

Examples of org.subethamail.smtp.io.DotTerminatedOutputStream.writeTerminatingSequence()


  @Test
  public void testEmpty() throws IOException
  {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DotTerminatedOutputStream stream = new DotTerminatedOutputStream(out);
    stream.writeTerminatingSequence();
    assertArrayEquals(".\r\n".getBytes("US-ASCII"), out.toByteArray());
  }

  @Test
  public void testMissingCrLf() throws IOException
View Full Code Here


  public void testMissingCrLf() throws IOException
  {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DotTerminatedOutputStream stream = new DotTerminatedOutputStream(out);
    stream.write('a');
    stream.writeTerminatingSequence();
    assertArrayEquals("a\r\n.\r\n".getBytes("US-ASCII"), out.toByteArray());
  }

  @Test
  public void testMissingCrLfByteArray() throws IOException
View Full Code Here

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DotTerminatedOutputStream stream = new DotTerminatedOutputStream(out);
    stream.write(new byte[]{
      'a'
    });
    stream.writeTerminatingSequence();
    assertArrayEquals("a\r\n.\r\n".getBytes("US-ASCII"), out.toByteArray());
  }

  @Test
  public void testExistingCrLf() throws IOException
View Full Code Here

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DotTerminatedOutputStream stream = new DotTerminatedOutputStream(out);
    stream.write('a');
    stream.write('\r');
    stream.write('\n');
    stream.writeTerminatingSequence();
    assertArrayEquals("a\r\n.\r\n".getBytes("US-ASCII"), out.toByteArray());
  }

  @Test
  public void testExistingCrLfByteArray() throws IOException
View Full Code Here

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DotTerminatedOutputStream stream = new DotTerminatedOutputStream(out);
    stream.write(new byte[]{
        'a', '\r', '\n'
    });
    stream.writeTerminatingSequence();
    assertArrayEquals("a\r\n.\r\n".getBytes("US-ASCII"), out.toByteArray());
  }
}
View Full Code Here

            int cRead;
            while (-1 != (cRead = mailAsStream.read(buffer))) {
                dotOutputStream.write(buffer, 0, cRead);
            }
            dotOutputStream.flush();
            dotTerminatedOutputStream.writeTerminatingSequence();
            dotTerminatedOutputStream.flush();
            logger.debug("Message sent");
        } finally {
            mailAsStream.close();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.