public byte[] readEvent() throws IOException {
        try {
            if (!channel.isOpen() || !consumeToStartOfEvent()) {
                return null;
            }
            RecordHeader header = RecordHeader.get(currentBlock);
            streamPosition += RECORD_HEADER_SIZE;
            int cumReadSize = 0;
            int bufferSize = header.getTotalEventSize().orElseGet(header::getSize);
            ByteBuffer buffer = ByteBuffer.allocate(bufferSize);
            getRecord(buffer, header);
            cumReadSize += header.getSize();
            while (cumReadSize < bufferSize) {
                maybeRollToNextBlock();
                RecordHeader nextHeader = RecordHeader.get(currentBlock);
                streamPosition += RECORD_HEADER_SIZE;
                getRecord(buffer, nextHeader);
                cumReadSize += nextHeader.getSize();
            }
            return buffer.array();
        } catch (ClosedByInterruptException e) {
            return null;
        }
    }
@Test
    public void testReadWhileWriteAcrossBoundary() throws Exception {
        char[] tooBig = fillArray( BLOCK_SIZE/4);
        StringElement input = new StringElement(new String(tooBig));
        byte[] inputSerialized = input.serialize();
        try(RecordIOWriter writer = new RecordIOWriter(file);
            RecordIOReader reader = new RecordIOReader(file)){

            for (int j = 0; j < 2; j++) {
                writer.writeEvent(inputSerialized);
            }
            assertThat(reader.readEvent(), equalTo(inputSerialized));
            for (int j = 0; j < 2; j++) {
                writer.writeEvent(inputSerialized);
            }
            for (int j = 0; j < 3; j++) {
                assertThat(reader.readEvent(), equalTo(inputSerialized));
            }
        }
    }