// InputStream is shorter than the length argument implies.
InputStream is = new ByteArrayInputStream(buf);
runBrokenStream(is, buf.length + 1);
// InputStream throws an Exception during read.
is = new BrokenInputStream(new ByteArrayInputStream(buf), buf.length / 2);
runBrokenStream(is, buf.length);
// Invalid length < 0.
is = new ByteArrayInputStream(buf);
runBrokenStream(is, -1);