protected void runLoop2() {
		int numKeys = 0;
		try {
			log.info("going into selector");
			numKeys = selector.select();
			log.info("coming out with keys="+numKeys);
		} catch (IOException e) {
			log.log(Level.WARNING, "Having trouble with a channel", e);
		}
		Set<SelectionKey> keySet = selector.selectedKeys();
		Iterator<SelectionKey> iter = keySet.iterator();	
		while (iter.hasNext()) {
			try {
				SelectionKey theKey = iter.next();
				log.info("in loop iter.next="+theKey+" isVal="+theKey.isValid()+" acc="
						+theKey.isAcceptable()+" read="+theKey.isReadable());
				if(theKey.isAcceptable()) {
					SocketChannel temp = server.accept();
					if(temp != null) {
						serverChannel = temp;
						serverChannel.configureBlocking(false);
						log.info("register serverChannel");
						serverChannel.register(selector, SelectionKey.OP_READ);
					}
				} else if(theKey.isReadable()) {
					log.info("reading bytes");
					buf.clear();
					int bytes = serverChannel.read(buf);
					log.info("read bytes="+bytes);
					iter.remove();
					if(bytes < 0)
						theKey.cancel();
					//keySet.remove(theKey);					
					synchronized(client) {
						log.info("waiting for write");
						receivedWrite = true;
						client.notify();
					}
					synchronized(client) {
						log.info("received write but not close yet, wait for client to call close");
						if(!closeHappened)
							client.wait();
					}
					log.info("done waiting for close, it happened");
				}
			} catch(Throwable e) {
				log.log(Level.WARNING, "Processing of key failed, but continuing channel manager loop", e);
			}
		}
		keySet.clear();
	}