public void run() {
		logger.info("JMemProxy is running on port " + this.port);
		try {
			channel.socket().bind(new InetSocketAddress(port)); //or InetSocketAddress(host, port)
			channel.register(JMemProxyFrontend.selector, SelectionKey.OP_ACCEPT);
			while (true) {
				int count = JMemProxyFrontend.selector.select();
				if (count < 1) continue;
				
				Iterator<SelectionKey> iterator = JMemProxyFrontend.selector.selectedKeys().iterator();
				while (iterator.hasNext()) {
					SelectionKey key = iterator.next();
					iterator.remove();
					
					if (!key.isValid()) continue;
					if (key.isAcceptable()) {
						SocketChannel ch = ((ServerSocketChannel)key.channel()).accept();
						ch.configureBlocking(false);
						ch.register(JMemProxyFrontend.selector, SelectionKey.OP_READ);
						logger.info("New connection from client: " + ch.getRemoteAddress().toString());
					} else if (key.isReadable()) {
						readAndDispatchToBackend(key);
					}
				}
			}
		} catch(Exception ex) {
			ex.printStackTrace();
		}
	}