@Test
	public void testStreamSkipReadMixSmallerDelegateThrows() throws IOException {
		LimitedInputStream stream = streamUsingSmallStreamThrows;
		int limit = HALF_LIMIT;
		long total = 0;
		do {
			int count = (int)(Math.random() * 10);
			if (total + count == limit) {
				count++;
			}
			boolean underflow = total + count > limit;
			long expectedResult = underflow ? limit - total : count;
			long actual;
			boolean read = false;
			try {
				read = Math.random() > 0.5;
				if (read) {
					actual = stream.read(BUFFER, 0, count);
					assertEquals("Number of expected reads (read=" + total + "; count=" + count + "; expected=" + expectedResult + "; actual=" + actual, expectedResult, actual);
				}
				else {
					actual = stream.skip(count);
					assertEquals("Number of expected skips (read=" + total + "; count=" + count + "; expected=" + expectedResult + "; actual=" + actual, expectedResult, actual);
				}
				if (underflow) {
					fail("Expected EOF on exceeding buffer limit");
				}
				total += actual;
			}
			catch (EOFException e) {
				if (!underflow) {
					fail("Unexpected EOF while " + (read ? "reading" : "skipping") + "(read=" + total + "; count=" + count + "; expected=" + expectedResult + ")");
				}
				break;
			}
		}
		while (total < limit);
	}