msgFuture.addListener(new Runnable() {
@Override
public void run() {
try {
Message message = msgFuture.get();
// System.out.println(ToStringBuilder.reflectionToString(message));
for (Message.BodyPart bodyPart : message.getBodyParts()) {
// System.out.println(ToStringBuilder.reflectionToString(bodyPart));
}
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println(message.getImapUid());
System.out.println(message.getHeaders().get("Message-ID"));
System.out.println(message.getHeaders());
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>\n\n\n");
// System.out.println("Gmail flags set: " +
// client.addFlags(allMail, message.getImapUid(),
// ImmutableSet.of(Flag.SEEN)).get());
// System.out
// .println("Matched UID: " + (message.getImapUid() == messageStatuses.get()
// .iterator()
// .next()
// .getImapUid()));
// System.out.println("Fetched: " + message);
dumpBodyParts(message.getBodyParts(), "");
countDownLatch.countDown();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {