code: @SuppressWarnings("unchecked")
    public static <T extends RemoteProxy> T getNewInstance(
        RegistrationRequest request, GridRegistry registry) {
      try {
        String proxyClass = request.getConfiguration().proxy;
        if (proxyClass == null) {
          log.fine("No proxy class. Using default");
          proxyClass = BaseRemoteProxy.class.getCanonicalName();
        }
        Class<?> clazz = Class.forName(proxyClass);
        log.fine("Using class " + clazz.getName());
        Object[] args = new Object[]{request, registry};
        Class<?>[] argsClass = new Class[]{RegistrationRequest.class, GridRegistry.class};
        Constructor<?> c = clazz.getConstructor(argsClass);
        Object proxy = c.newInstance(args);
        if (proxy instanceof RemoteProxy) {
          ((RemoteProxy) proxy).setupTimeoutListener();
          return (T) proxy;
        }
        throw new InvalidParameterException("Error: " + proxy.getClass() + " isn't a remote proxy");
      } catch (InvocationTargetException e) {
        throw new InvalidParameterException("Error: " + e.getTargetException().getMessage());
      } catch (Exception e) {
        throw new InvalidParameterException("Error: " + e.getMessage());
      }
    }
docs: Takes a registration request and return the RemoteProxy associated to it. It can be any class
  extending RemoteProxy.
  
  @param request  The request
  @param registry The registry to use
  @param <T> RemoteProxy subclass
  @return a new instance built from the request.