For testing purposes, our platform can be connected to an email simulator which collects email requests and can be queried to display all received emails. Our current implementation is based on GreenMail. It works basically fine, but when we send many emails, the simulator will at some point die with an OutOfMemoryError.
We have solved similar issues with our other (self-implemented) simulators (SMS, APNS, GCM) by replacing the simple Lists which were used to store the received messages with Guava's EvictingQueues, so they keep themselves alive even when spammed.
Does anyone know a library out there which we can use to simulate email reception, but that can purge the oldest messages automatically?