public synchronized boolean hasEndOfBlock() {
        return endOfBlockIndex >= 0;
    }
@Test
    public void testHasEndOfBlock() {
        assertFalse(instance.hasEndOfBlock(), "Unexpected initial value");

        instance.write(MllpProtocolConstants.END_OF_BLOCK);
        assertFalse(instance.hasEndOfBlock(), "START_OF_BLOCK before an END_OF_BLOCK");

        instance.reset();
        assertFalse(instance.hasEndOfBlock());

        instance.write(MllpProtocolConstants.START_OF_BLOCK);
        assertFalse(instance.hasEndOfBlock());

        instance.write(TEST_HL7_MESSAGE.getBytes());
        assertFalse(instance.hasEndOfBlock());

        instance.write(MllpProtocolConstants.END_OF_BLOCK);
        assertTrue(instance.hasEndOfBlock());

        instance.write(MllpProtocolConstants.END_OF_DATA);
        assertTrue(instance.hasEndOfBlock());

        instance.reset();
        assertFalse(instance.hasEndOfBlock());

        instance.write(MllpProtocolConstants.START_OF_BLOCK);
        assertFalse(instance.hasEndOfBlock());

        instance.write(TEST_HL7_MESSAGE.getBytes());
        assertFalse(instance.hasEndOfBlock());

        instance.write(MllpProtocolConstants.END_OF_BLOCK);
        assertTrue(instance.hasEndOfBlock());

        instance.write("BLAH".getBytes());
        assertTrue(instance.hasEndOfBlock());
    }