See this replace getRemoteAddr() by getLocalPort(). Be aware that server port number (often 8080) differs from the webserver port (80).