Added unit tests.  Added middleware emits 'autoreap' events on clean.