public void testExceptions() throws IOException {
		setNumberOfExpectedWarnings(2);
		
		if (log.isLoggable(Level.FINE))
			log.log(Level.FINE, "started");
			
		ByteBuffer b = ByteBuffer.allocate(200);

		
		b.putInt(-6); //2*10 because chars are 2 bytes.
		helper.putString(b, HALF1+HALF2);
		b.putInt(20);
		helper.doneFillingBuffer(b);
		
		try {
			//feed packet with negative size.....
			unpacketizer.incomingData(b, null);
			fail("Should have thrown a RuntimeException");
		} catch(CorruptPacketException e) {
			assertTrue("header should be corrupt", e.isHeaderCorrupt());
		}
		
		listener.expect(MockObject.NONE);
		
		if (log.isLoggable(Level.FINE))
			log.log(Level.FINE, "FEEDING NEXT BAD PACKET************");
		helper.eraseBuffer(b);
		b.putInt(100000000); //2*10 because chars are 2 bytes.
		helper.putString(b, HALF1+HALF2);
		b.putInt(20);
		helper.doneFillingBuffer(b);
		
		try {
			//feed incoming packet with two large a header(ie. size is less than max size of packet)
			unpacketizer.incomingData(b, null);
			fail("Should have thrown an Exception");
		} catch(CorruptPacketException e) {
			assertTrue("header should be corrupt", e.isHeaderCorrupt());			
		}		
		listener.expect(MockObject.NONE);		

		if (log.isLoggable(Level.FINE))
			log.log(Level.FINE, "FEEDING NULL************");
		try {
			unpacketizer.incomingData(null, null);
			fail("Should have thrown a RuntimeException");
		} catch(IllegalArgumentException e) {
			assertEquals("Message was incorrect", "someId evt cannot be null", e.getMessage());
		}		
		listener.expect(MockObject.NONE);	

		if (log.isLoggable(Level.FINE))
			log.log(Level.FINE, "ended");
	}
	
//	public void testNoTrailerFailure() {
//		String fullString = half1+half2;
//		int size = fullString.getBytes().length;
//		ByteBuffer b = ByteBuffer.allocate(size+30);
//		b.putInt(size);
//		helper.putString(b, fullString);
//		//look, no packet separator mom!!!!
//		//put the string again just for some junk data
//		helper.putString(b, "a");
//		b.put(packetSeparator); //now put the packet separator
//		b.putInt(size);
//		helper.putString(b, fullString);
//		helper.doneFillingBuffer(b);
//
//		//contract is a rewound buffer that it can read to begin with.
//		try {
//			unpacketizer.notify(b);
//			fail("Should have thrown an exception");
//		} catch(CorruptPacketException e) {
//			assertTrue("trailer should have failed", e.isTrailerCorrupt());
//		}
//		
//		//should still recover and get the good packet behind the bad one....
//		CalledMethod method = listener.expect(PACKET_METHOD);
//		
//		verifyBuffer(method, fullString, size);		
//	}
//	
//	public void testFailureWithPacketSeparatorInPacket() {
//		
//	}
//	
//	//trailer failure should be thrown back to client rather than throwing listener's
//	//failure as the first failure is what is needed usually to debug the problem and
//	//maybe causing the second failure!!!
//	public void testListenerFailureAfterTrailerFailure() {
//		
//	}