mimeMessage.setFrom(froms[0]);
mimeMessage.setSubject(subject);
mimeMessage.setText(body);
GreenMailUtil.sendMimeMessage(mimeMessage);
greenMail.waitForIncomingEmail(5000,1);
<BUG>retrieveAndCheck(new Retriever(greenMail.getImap()), to, subject);
}
private void retrieveAndCheck(Retriever retriever, String to, String subject) throws MessagingException, IOException {

Message[] messages = retriever.getMessages(to);</BUG>
assertEquals(1, messages.length);

mimeMessage.setFrom(froms[0]);
mimeMessage.setSubject(subject);
mimeMessage.setText(body);
GreenMailUtil.sendMimeMessage(mimeMessage);
greenMail.waitForIncomingEmail(5000,1);
retrieveAndCheck(greenMail.getImap(), to, subject);
}
private void retrieveAndCheck(AbstractServer server, String to, String subject) throws MessagingException, IOException {
Retriever retriever = new Retriever(server);
try {
Message[] messages = retriever.getMessages(to);
assertEquals(1, messages.length);
