Implement #246, works awesome in tests, not so much in an OSGi container for some reason