@Test
public void testParseCase515() {

    List<WebSocketFrame> send = new ArrayList<>();
    send.add(new TextFrame().setPayload("fragment1").setFin(false));
    send.add(new ContinuationFrame().setPayload("fragment2").setFin(true));
    send.add(new ContinuationFrame().setPayload("fragment3").setFin(false)); // bad frame
    send.add(new TextFrame().setPayload("fragment4").setFin(true));
    send.add(new CloseInfo(StatusCode.NORMAL).asFrame());
    ByteBuffer completeBuf = UnitGenerator.generate(send);
    UnitParser parser = new UnitParser();
    IncomingFramesCapture capture = new IncomingFramesCapture();
    parser.setIncomingFramesHandler(capture);
    ProtocolException x = assertThrows(ProtocolException.class, () -> parser.parseQuietly(completeBuf));
    assertTrue(x.getMessage().contains("CONTINUATION frame without prior !FIN"));
}