@Override
	public void run()
	{
		while ( !socket.isClosed() )
		{
			try
			{
				Socket connection = socket.accept();

				try
				{
					requestHandler( connection );
				}
				finally
				{
					try
					{
						if ( !connection.isClosed() )
							connection.close();
					}
					catch ( IOException e )
					{
						HTTPConsole.log( Level.WARNING, "The connection was prematurely closed" );
					}
				}
			}
			catch ( Exception e )
			{
				if ( e instanceof java.io.IOException && stopping )
					return;
				
				HTTPConsole.logException( e, "Error while handling an HTTP request." );
			}
		}
	}