code: public static <T extends VersionedProtocol> ProtocolProxy<T> getProtocolProxy(
        Class<T> protocol,
        long clientVersion, InetSocketAddress addr, Configuration conf,
        SocketFactory factory) throws IOException {
      UserGroupInformation ugi = null;
      try {
        ugi = UserGroupInformation.login(conf);
      } catch (LoginException le) {
        throw new RuntimeException("Couldn't login!");
      }
      return getProtocolProxy(protocol, clientVersion, addr, ugi, conf, factory);
    }
docs: Construct a client-side protocol proxy that contains a set of server
  methods and a proxy object implementing the named protocol,
  talking to a server at the named address.