Fix the PMD warnings that failed Outreach.

The `INADDR_ANY` constant ended up being copied a couple of places, because I couldn't find a good spot to put it, where all the other files could see it. Comments welcome.

I also did some light refactoring, and fixed a couple of Intellij inspection warnings.