code: protected synchronized ClientProtocol createNameNodeProxy(UnixUserGroupInformation ugi
        ) throws IOException {
      if (nnProxy != null) {
        return nnProxy;
      }
      ServletContext context = getServletContext();
      InetSocketAddress nnAddr = (InetSocketAddress)context.getAttribute("name.node.address");
      if (nnAddr == null) {
        throw new IOException("The namenode is not out of safemode yet");
      }
      Configuration conf = new Configuration(
          (Configuration)context.getAttribute("name.conf"));
      UnixUserGroupInformation.saveToConf(conf,
          UnixUserGroupInformation.UGI_PROPERTY_NAME, ugi);
      nnProxy = DFSClient.createNamenode(nnAddr, conf);
      return nnProxy;
    }
docs: Create a {@link NameNode} proxy from the current {@link ServletContext}.