@Override
	public void run() {
		try {
			this.setName ("ListenThread");
		} catch (Exception e) {
		}
		
		D.out("HTTP Server / Webinterface started on http://127.0.0.1:" + this.port);

		ArrayList<Class<?>> possibleHandlers = new ArrayList<Class<?>>();
		// the first are probably the most used
		possibleHandlers.add(HostFinderRequest.class);
		possibleHandlers.add(AllowMeRequest.class);
		possibleHandlers.add(IndexRequest.class);

		possibleHandlers.add(DAVRequest.class);
		possibleHandlers.add(FileRequest.class);
		possibleHandlers.add(ConfigRequest.class);
		possibleHandlers.add(LanMessageRequest.class);
		
		possibleHandlers.add(LoginRequest.class);
		possibleHandlers.add(LogoutRequest.class);
		possibleHandlers.add(OneTimeRequest.class);
		possibleHandlers.add(OptionsRequest.class);
		possibleHandlers.add(HostlistHTMLRequest.class);
		
		// also often used, but takes the longest processing time ;)
		possibleHandlers.add(StaticInternalFileRequest.class);
		possibleHandlers.add(AboutRequest.class);
		possibleHandlers.add(SearchRequest.class);
		possibleHandlers.add(WebDAVSearchRequest.class);
		possibleHandlers.add(FwdRequest.class);
		
		
		// if nothing matches
		possibleHandlers.add(UnknownRequest.class);
		

		threadPoolExecutor = new ThreadPoolExecutor(10,
				Constants.MAX_INCOMING_HTTP_CONNECTIONS, // FIXME
                25,
                TimeUnit.SECONDS,
                (BlockingQueue<Runnable>) threadPool,
                this);
		
	
		
		while (true) {
			try {
				// Pass the socket to a new thread so that it can be dealt with
				// while we can go and get ready to accept another connection.
				//this.serverSocketChannel.socket().setSoTimeout(30 * 1000);
				SocketChannel socketChannel = this.serverSocketChannel.accept();

				SynchronousLogicalStreamConnection incomingTCP = ConnectionFactory.createIncomingTCP(socketChannel);
				
				RequestThread requestThread = new RequestThread(incomingTCP, possibleHandlers);
				requestThread.setLocalPort (port);
				requestThread.setLocalIP (socketChannel.socket().getLocalAddress().getHostAddress());
				requestThread.setRemoteIP (socketChannel.socket().getInetAddress().getHostAddress());
				requestThread.setRemotePort(socketChannel.socket().getPort());
					
				//DNSCache.lookupForLater(requestThread.getRemoteIP());
					
				threadPoolExecutor.execute(requestThread);
				
				//requestExecutorService.submit(requestThread);
			} catch (RejectedExecutionException e) {
				e.printStackTrace();
			} catch (SocketTimeoutException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}