@Override
	public void onNIOEvent(SelectionKey key)
	{
		if( key.isWritable() )
		{
			boolean removeEvent = false;

			ChannelEvent event = writeQueue.peek();
			try
			{
				if( removeEvent = (event != null && handleOutgoingEvent(event)) )
					event.getFuture().onSuccess();
			}
			catch(Exception e)
			{
				removeEvent = true;
				if( event != null )
					event.getFuture().onException(e);
			}

			if( removeEvent )
			{
				writeQueue.remove();

				if( writeQueue.isEmpty() )
					dispatcher.setInterestOps(this, dispatcher.getInterestOps(this)
							^ SelectionKey.OP_WRITE);
			}
		}
	}