@Test
public void testLongHeader() throws Exception {

    StringBuilder inputBuilder = new StringBuilder();
    for (int i = 0; i < 2000; ++i) {
        inputBuilder.append( //len > 50
                "really really really really really really long name ");
    }
    String name = inputBuilder.toString();
    byte[] data = ("Status: 520\r\nFrom: " + name + "\r\n\r\n").getBytes(US_ASCII);
    ContentHandler handler = new DefaultHandler();
    Metadata metadata = new Metadata();
    ParseContext context = new ParseContext();
    try {
        EXTRACT_ALL_ALTERNATIVES_PARSER.parse(
                new ByteArrayInputStream(data), handler, metadata, context);
        fail();
    } catch (TikaException expected) {
    }
    MimeConfig config = new MimeConfig.Builder().setMaxHeaderLen(-1).setMaxLineLen(-1).build();
    context.set(MimeConfig.class, config);
    EXTRACT_ALL_ALTERNATIVES_PARSER.parse(
            new ByteArrayInputStream(data), handler, metadata, context);
    assertEquals(name.trim(), metadata.get(TikaCoreProperties.CREATOR));
}