Random random = random();
final RAMDirectory dir = new RAMDirectory();
IndexOutput os = dir.createOutput("foo", newIOContext(random));
os.writeBytes(READ_TEST_BYTES, READ_TEST_BYTES.length);
os.close();
IndexInput is = dir.openInput("foo", newIOContext(random));
checkReads(is, IOException.class);
is.close();
os = dir.createOutput("bar", newIOContext(random));
os.writeBytes(RANDOM_TEST_BYTES, RANDOM_TEST_BYTES.length);