@Test
public void testReadObjectOrdinaryNPE() throws Exception {

	UnsyncByteArrayOutputStream unsyncByteArrayOutputStream =
		new UnsyncByteArrayOutputStream();
	unsyncByteArrayOutputStream.write(SerializationConstants.TC_OBJECT);
	unsyncByteArrayOutputStream.write(1);
	unsyncByteArrayOutputStream.write(new byte[4]);
	ObjectOutputStream objectOutputStream = new ObjectOutputStream(
		unsyncByteArrayOutputStream);
	Date date = new Date(123456);
	objectOutputStream.writeObject(date);
	ByteBuffer byteBuffer =
		unsyncByteArrayOutputStream.unsafeGetByteBuffer();
	// Corrupt magic header
	byteBuffer.put(6, (byte)0xFF);
	Deserializer deserializer = new Deserializer(byteBuffer);
	try {
		deserializer.readObject();
		Assert.fail();
	}
	catch (RuntimeException runtimeException) {
		Assert.assertTrue(
			runtimeException.getCause() instanceof
				StreamCorruptedException);
	}
}