Refactor groovy to java

Converts and fixes nginx tests
Too many `}`s