Gradle build gets stuck if one of the shoutdown hooks of tests is stuck. This happens because
. Typically it is good but in some cases when test is stuck whole build is never terminated.
The suggestion is to add parameter timeout. Then run System.exit(0) in thread and join it. If thread is not terminated during specified period use
. This will make test to fail and build to finish.