@Test public void testCreatedMessageLineMaxLimit(){ SOAPMessage soapMessage = null; MimeMessage mimeMsg = null; MimeHeaders mimeHeaders = new MimeHeaders(); InputStream contentStream = FIXTURE_LOADER.getResourceAsStream("mime_message_content.dat"); mimeHeaders.setHeader("Content-Type", "text/xml; charset=utf-8"); try { soapMessage = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createMessage(mimeHeaders,contentStream); } catch (IOException e) { e.printStackTrace(); Assert.fail("Failed on loading the content inputstream\n"+e.getMessage()); } catch (SOAPException e) { e.printStackTrace(); Assert.fail("Create SOAP Message Failed\n"+e.getMessage()); } if(soapMessage == null) Assert.fail("Create SOAP Message Failed\n Message Should not be Null."); System.out.println("SoapMessage Created."); try { mimeMsg = mailSender.createMessage(MAIL_FROM, MAIL_TO, "", "SOAPMailSenderTest.testCreatedMessageLineMaxLimit", soapMessage); } catch (ConnectionException e) { e.printStackTrace(); Assert.fail("Create MimeMessage Failed\n"+e.getMessage()); } if(mimeMsg == null) Assert.fail("Create MimeMessage Failed\n Message Should not be Null."); System.out.println("MimeMessage Created."); ByteArrayOutputStream bbOutputStream = new ByteArrayOutputStream(); try { mimeMsg.writeTo(bbOutputStream); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } System.out.println("Begin assertion on message content."); byte[] msgContent = bbOutputStream.toByteArray(); System.out.println("Mime Message Size: " + msgContent.length); int contentCount = 0; for(int index =0; index < msgContent.length; index++){ boolean startofLine = false; if(msgContent[index] == 0x0D && msgContent[index+1] == 0x0A){ ++index; contentCount = 0; Assert.assertTrue(contentCount<=990); } else{ contentCount++; } } }
public MimeMessage createMessage(String from, String to, String cc, String subject, SOAPMessage soapMessage) throws ConnectionException { return createMessage(from, to, cc, subject, soapMessage, createSession()); }
SOAPMailSender extends MailSender { public MimeMessage createMessage(String from, String to, String cc, String subject, SOAPMessage soapMessage) throws ConnectionException { return createMessage(from, to, cc, subject, soapMessage, createSession()); } }
SOAPMailSender extends MailSender { public MimeMessage createMessage(String from, String to, String cc, String subject, SOAPMessage soapMessage) throws ConnectionException { return createMessage(from, to, cc, subject, soapMessage, createSession()); } SOAPMailSender(String host);  SOAPMailSender(String protocol, String host);  SOAPMailSender(String host, String username, String password);  SOAPMailSender(String protocol, String host, String username,
            String password); }
SOAPMailSender extends MailSender { public MimeMessage createMessage(String from, String to, String cc, String subject, SOAPMessage soapMessage) throws ConnectionException { return createMessage(from, to, cc, subject, soapMessage, createSession()); } SOAPMailSender(String host);  SOAPMailSender(String protocol, String host);  SOAPMailSender(String host, String username, String password);  SOAPMailSender(String protocol, String host, String username,
            String password); MimeMessage createMessage(String from, String to, String cc,
            String subject, SOAPMessage soapMessage); MimeMessage createMessage(String from, String to, String cc,
            String subject, SOAPMessage soapMessage, Session session); void send(String from, String to, String cc, String subject,
            SOAPMessage soapMessage); }
SOAPMailSender extends MailSender { public MimeMessage createMessage(String from, String to, String cc, String subject, SOAPMessage soapMessage) throws ConnectionException { return createMessage(from, to, cc, subject, soapMessage, createSession()); } SOAPMailSender(String host);  SOAPMailSender(String protocol, String host);  SOAPMailSender(String host, String username, String password);  SOAPMailSender(String protocol, String host, String username,
            String password); MimeMessage createMessage(String from, String to, String cc,
            String subject, SOAPMessage soapMessage); MimeMessage createMessage(String from, String to, String cc,
            String subject, SOAPMessage soapMessage, Session session); void send(String from, String to, String cc, String subject,
            SOAPMessage soapMessage);  }