@Test
public void testLargeField() {

	ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
	// field length < 0x80
	byteStream.write(1); // tag
	byteStream.write(0x7f); // length
	for (int i = 0; i < 0x7f; i++) {
		byteStream.write(0x12); // data
	}
	// field length = 0x80
	byteStream.write(2); // tag
	byteStream.write(0x81); // length
	byteStream.write(0x00);
	for (int i = 0; i < 0x80; i++) {
		byteStream.write(0x34); // data
	}
	// field length = 0x3fff
	byteStream.write(3); // tag
	byteStream.write(0xff); // length
	byteStream.write(0x7f);
	for (int i = 0; i < 0x3fff; i++) {
		byteStream.write(0x56); // data
	}
	// field length = 0x4000
	byteStream.write(4); // tag
	byteStream.write(0x81); // length
	byteStream.write(0x80);
	byteStream.write(0x00);
	for (int i = 0; i < 0x4000; i++) {
		byteStream.write(0x78); // data
	}
	// our check field
	byteStream.write(100);
	byteStream.write(4);
	byteStream.write(0xca);
	byteStream.write(0xfe);
	byteStream.write(0xba);
	byteStream.write(0xbe);
	byte[] file = byteStream.toByteArray();
	// operate
	LargeField largeField = TlvParser.parse(file, LargeField.class);
	// verify
	assertEquals(0x7f, largeField.field1.length);
	assertArrayEquals(new byte[]{(byte) 0xca, (byte) 0xfe, (byte) 0xba,
			(byte) 0xbe}, largeField.field2);
}