D-12341 Memory leak fix - really gone this time! + SPOCK testing

1. Fixed the memory leak for reals this time guys!
2. Increased sleep time in a flaky test (cuz my laptop is ancient)
3. Added Spock and Groovy for functional testing