[JENKINS-8856]

Added additional diagnostic code that will try to read ahead and provide
what's ahead in the input stream.
added another test case