I would suggest to embed a pure Java IMAP/POP server in your test code.
For that, you have numerous possibilities, including:
- Write your own IMAP mock using Javamail
- Use Dwarf mail server
- Use JMock to emulate the various interfaces of your mail server (after all, it must have an interface, no ?)