@Test
public void testExceptionPropagationWriter() {

	try {
		// use atomic boolean as a boolean reference
		final AtomicBoolean handlerCalled = new AtomicBoolean();
		final AtomicBoolean exceptionForwarded = new AtomicBoolean();
		
		WriteRequest req = new WriteRequest() {
			
			@Override
			public void requestDone(IOException ioex) {
				if (ioex instanceof TestIOException) {
					exceptionForwarded.set(true);
				}
				
				synchronized (handlerCalled) {
					handlerCalled.set(true);
					handlerCalled.notifyAll();
				}
			}
			
			@Override
			public void write() throws IOException {
				throw new TestIOException();
			}
		};
		
		
		// test the read queue
		RequestQueue<WriteRequest> rq = ioManager.getWriteRequestQueue(ioManager.createChannel());
		rq.add(req);
		// wait until the asynchronous request has been handled
		synchronized (handlerCalled) {
			while (!handlerCalled.get()) {
				handlerCalled.wait();
			}
		}
		
		assertTrue(exceptionForwarded.get());
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}