@Override
    public Headers add(Header header) throws IllegalStateException {
        Objects.requireNonNull(header, "Header cannot be null.");
        canWrite();
        headers.add(header);
        return this;
    }
@Test
    public void testAdd() {
        Headers headers = new RecordHeaders();
        headers.add(new RecordHeader("key", "value".getBytes()));

        Header header = headers.iterator().next();
        assertHeader("key", "value", header);

        headers.add(new RecordHeader("key2", "value2".getBytes()));

        assertHeader("key2", "value2", headers.lastHeader("key2"));
        assertEquals(2, getCount(headers));
    }