java: Use IPConnection to access static members instead of ipcon
java: Remove some redundant casts
java: Ensure to set socket and stream to null even if close() throws an IOException
java: Use a shorter format for JavaDoc links
java: Remove more reduntant casts