Fixing shutdown of eureka client and reducing flakiness of a test.