Better handling of dead connections (JAVA-204)