code: protected boolean registerAllRequestsProcessedListener(NotificationListener listener) throws IOException {
  		checkNotNull(listener);
  
  		synchronized (listenerLock) {
  			if (allRequestsProcessedListener == null) {
  				// There was a race with the processing of the last outstanding request
  				if (requestsNotReturned.get() == 0) {
  					return false;
  				}
  
  				allRequestsProcessedListener = listener;
  
  				return true;
  			}
  		}
  
  		throw new IllegalStateException("Already subscribed.");
  	}
docs: Registers a listener to be notified when all outstanding requests have been processed.
  
  <p> New requests can arrive right after the listener got notified. Therefore, it is not safe
  to assume that the number of outstanding requests is still zero after a notification unless
  there was a close right before the listener got called.
  
  <p> Returns <code>true</code>, if the registration was successful. A registration can fail,
  if there are no outstanding requests when trying to register a listener.