<p>newExecutor.</p>

@param url a {@link java.lang.String} object.
@return a {@link com.greenpepper.server.rpc.xmlrpc.client.XmlRpcClientExecutor} object.
@throws com.greenpepper.server.rpc.xmlrpc.client.XmlRpcClientExecutorException if any.
774686
public static XmlRpcClientExecutor newExecutor(String url) throws XmlRpcClientExecutorException {

        try {
            LOGGER.debug("Instanciating new executor for url {} ", url);
            return new XmlRpcV2ClientImpl(url);
        } catch (Exception ex) {
            throw new XmlRpcClientExecutorException(GreenPepperServerErrorKey.GENERAL_ERROR, ex);
        }
    }
746185
public Peer newPeer(String name, String grpcURL) throws InvalidArgumentException {
        clientCheck();
        return Peer.createNewInstance(name, grpcURL, null);
    }
48562
public static ServerConfiguration load(URL url) throws Exception
    {
        config = new ServerConfiguration();
        config.loadConfig(url);
        return config;
    }
454865
public static SpecExecutor createDummySpecExecutor(URI uri) {
    Properties properties = new Properties();
    properties.setProperty(ConfigurationKeys.SPECEXECUTOR_INSTANCE_URI_KEY, uri.toString());
    return new InMemorySpecExecutor(ConfigFactory.parseProperties(properties));
  }
284233
private <T> T execute(String url, Class<T> returnType, Object requestObject) throws Exception {
        URLConnection connection = new URL(url).openConnection();
        if (!(connection instanceof HttpURLConnection)) {
            throw new IllegalStateException("Not an http connection! " + connection);
        }
        HttpURLConnection httpConnection = (HttpURLConnection) connection;
        httpConnection.setUseCaches(false);
        httpConnection.setDefaultUseCaches(false);
        httpConnection.setDoInput(true);

        /*
         * With followRedirects enabled, simple URL redirects work as expected. But with port redirects (http->https)
         * followRedirects doesn't work and a HTTP 302 code is returned instead (ARQ-1365).
         *
         * In order to handle all redirects in one place, followRedirects is set to false and all HTTP 302 response codes are
         * treated accordingly within the execute method.
         */
        httpConnection.setInstanceFollowRedirects(false);

        try {

            if (requestObject != null) {
                httpConnection.setRequestMethod("POST");
                httpConnection.setDoOutput(true);
                httpConnection.setRequestProperty("Content-Type", "application/octet-stream");
            }

            if (requestObject != null) {
                ObjectOutputStream ous = new ObjectOutputStream(httpConnection.getOutputStream());
                try {
                    ous.writeObject(requestObject);
                } catch (Exception e) {
                    throw new RuntimeException("Error sending request Object, " + requestObject, e);
                } finally {
                    ous.flush();
                    ous.close();
                }
            }

            try {
                httpConnection.getResponseCode();
            } catch (ConnectException e) {
                return null; // Could not connect
            }
            if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                ObjectInputStream ois = new ObjectInputStream(httpConnection.getInputStream());
                Object o;
                try {
                    o = ois.readObject();
                } finally {
                    ois.close();
                }

                if (!returnType.isInstance(o)) {
                    throw new IllegalStateException(
                        "Error reading results, expected a " + returnType.getName() + " but got "
                            + o);
                }
                return returnType.cast(o);
            } else if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_NO_CONTENT) {
                return null;
            } else if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP) {
                String redirectUrl = httpConnection.getHeaderField("Location");
                return execute(redirectUrl, returnType, requestObject);
            } else if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) {
                throw new IllegalStateException("Error launching test at " + url + ". " + "Got "
                    + httpConnection.getResponseCode() + " (" + httpConnection.getResponseMessage() + ")");
            }
        } finally {
            httpConnection.disconnect();
        }
        return null;
    }
301631
public <T> HttpClientRequest.Builder<T> get(final URI uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return new HttpClientRequest.Builder<T>(httpClientFactory, HttpClientMethod.GET, uri, httpHandler);
    }
520223
public static XPathUtils newXPath(final URL url) {
        final DefaultHttpClient client = new DefaultHttpClientImpl();
        final GetMethod method = new GetMethod(url.toExternalForm());
        try {
            final int responseCode = client.executeMethod(method);
            if (responseCode != HttpStatus.SC_OK) {
                LOG.warn("Unexpected response code: " + responseCode);
            } else {
                final InputStream is = method.getResponseBodyAsStream();
                return XPathUtils.newXPath(is);
            }
        } catch (final HttpException e) {
            LOG.warn("Could not handle XPath", e);
        } catch (final IOException e) {
            LOG.warn("Could not handle XPath", e);
        } catch (final SAXException e) {
            LOG.warn("Could not handle XPath", e);
        } finally {
            method.releaseConnection();
        }
        return null;
    }
1016406
protected ExecutorService createDefaultExecutorService(ConcurrentAsyncExecutorProvider provider) {
        final int corePoolSize = 0;
        Integer maximumPoolSize = provider != null ? provider.provideMaxPoolSize() : null;
        if (maximumPoolSize == null) {
            maximumPoolSize = 10;
        }
        final long keepAliveTime = 60L;
        final TimeUnit seconds = TimeUnit.SECONDS;
        final BlockingQueue<Runnable> workQueue = createDefaultBlockingQueue();
        final RejectedExecutionHandler rejected = createRejectedExecutionHandler();
        return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, seconds, workQueue, rejected);
    }
928525
public static Element getContentElementByUrl(String url) throws Exception {
//        HttpRequest request = new HttpRequest(url);
        String html = okHttpRequester.getResponse(url).html();
        return getContentElementByHtml(html, url);
    }
1098092
@Nullable
    public static Executor getTtlExecutor(@Nullable Executor executor) {
        if (TtlAgent.isTtlAgentLoaded() || null == executor || executor instanceof TtlEnhanced) {
            return executor;
        }
        return new ExecutorTtlWrapper(executor);
    }
1060719
public DocumentSource createDocumentSource(URL url) throws IOException
    {
        try
        {
            Constructor<? extends DocumentSource> constr = getDocumentSourceClass().getConstructor(URL.class);
            return constr.newInstance(url);
        } catch (Exception e) {
            Throwable cause = e; //find if there is an IOException cause and throw it
            while (cause != null && !(cause instanceof IOException))
                cause = e.getCause();
            if (cause != null && cause instanceof IOException)
                throw (IOException) cause;
            //no IO exception cause, this should not happen (some internal reflection problem)
            log.error("Could not create the DocumentSource instance: " + e.getMessage());
            e.printStackTrace();
            return null;
        }
    }
912101
public static ServiceDependencyBuilder restServiceDependency(final String url) {
        return new ServiceDependencyBuilder()
                .withUrl(url)
                .withType(ServiceDependency.TYPE_SERVICE)
                .withSubtype(ServiceDependency.SUBTYPE_REST)
                .withMethods(singletonList("GET"))
                .withMediaTypes(singletonList("application/json"));
    }
167444
public <T> HttpClientRequest.Builder<T> get(final String uri, final HttpClientResponseHandler<T> httpHandler)
    {
        return get(URI.create(uri), httpHandler);
    }
178469
@Override
    public ServletMethodExecutor getExecutor(ServletProtocolConfiguration protocolConfiguration,
        ProtocolMetaData metaData, CommandCallback callback) {
        Collection<HTTPContext> contexts = metaData.getContexts(HTTPContext.class);
        if (contexts.size() == 0) {
            throw new IllegalArgumentException(
                "No " + HTTPContext.class.getName() + " found in " + ProtocolMetaData.class.getName() + ". " +
                    "Servlet protocol can not be used");
        }
        return new ServletMethodExecutor(protocolConfiguration, contexts, callback);
    }
1052551
public HttpExecutor getHttpExecutor(BodyType bodyType) {
    if (httpClient == null) {
      synchronized (HttpExecutorFactory.class) {
        if (httpClient == null) {
          httpClient = HttpClients.createDefault();
        }
      }
    }
    return getHttpExecutor(bodyType, httpClient);
  }
521083
public static FoxHttpAuthorizationScope create(final String url) {
        if (url == null) {
            throw new IllegalArgumentException("url can not be null");
        }
        if (url.length() == 0) {
            throw new IllegalArgumentException("url can not be empty");
        }
        return new FoxHttpAuthorizationScope(url, "*");
    }
1352563
public int get(String url) throws Exception {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
                .url(url)
                .build();
        try(Response response = client.newCall(request).execute()) {
            if (!response.isSuccessful()) {
                throw new Exception("error sending HTTP GET to this URL: " + url);
            }
            return response.code();
        }
    }