code: static <V extends VersionedProtocol> V waitForProxy(Class<V> protocol, InetSocketAddress addr,
  			long timeout) throws IOException {
  		long startTime = System.currentTimeMillis();
  		IOException ioe;
  		while (true) {
  			try {
  				return getProxy(protocol, addr);
  			} catch (ConnectException se) { // namenode has not been started
  				LOG.info("Server at " + addr + " not available yet, Zzzzz...");
  				ioe = se;
  			} catch (SocketTimeoutException te) { // namenode is busy
  				LOG.info("Problem connecting to server: " + addr);
  				ioe = te;
  			}
  			// check if timed out
  			if (System.currentTimeMillis() - timeout >= startTime) {
  				throw ioe;
  			}
  
  			// wait for retry
  			try {
  				Thread.sleep(1000);
  			} catch (InterruptedException ie) {
  				// IGNORE
  			}
  		}
  	}
docs: Get a proxy connection to a remote server
  
  @param protocol
  protocol class
  @param addr
  remote address
  @param timeout
  time in milliseconds before giving up
  @return the proxy
  @throws IOException
  if the far end through a RemoteException