Refactor groovy to java

Converts and fixes nginx tests