private void triggerException() throws IOException {
        if (remainingBytes <= (lengthInBytes / 2) && !hasTriggeredAnException) {
            hasTriggeredAnException = true;
            final String msg = "UnreliableBogusInputStream fired an IOException after reading " + getBytesRead() + " bytes.";
            if (DEBUG)
                System.err.println(msg);
            throw new IOException(msg);
        }
    }
@see com.amazonaws.util.RandomInputStream#read()
aws-java-sdk-test-utils/src/main/java/com/amazonaws/test/util/UnreliableRandomInputStream.java