[JENKINS-20074] First problem: extended EOF checks for JENKINS-10524.
[JENKINS-20074] Make the JENKINS-10524 exception checking logic public, as it will be needed elsewhere.