Utility function that constructs AdminClient.

@param url URL pointing to the bootstrap node
@return Newly constructed AdminClient
420439
public static AdminClient getAdminClient(String url) {
        ClientConfig config = new ClientConfig().setBootstrapUrls(url)
                                                .setConnectionTimeout(5, TimeUnit.SECONDS);

        AdminClientConfig adminConfig = new AdminClientConfig().setAdminSocketTimeoutSec(5);
        return new AdminClient(adminConfig, config);
    }
1238787
public static function createInstallationClient($url, CertificateStorage $certificateStorage)
    {
        $handlerStack = HandlerStack::create();
        $handlerStack->push(
            Middleware::mapRequest(new RequestIdMiddleware())
        );
        $handlerStack->push(
            Middleware::mapRequest(new RequestSignatureMiddleware($certificateStorage->load(CertificateType::PRIVATE_KEY())))
        );

        return self::createBaseClient((string)$url, $handlerStack);
    }
526010
public static ConsulService buildService(URL url) {
        ConsulService service = new ConsulService();
        service.setAddress(url.getHost());
        service.setId(ConsulUtils.convertConsulSerivceId(url));
        service.setName(url.getPath());
        service.setPort(url.getPort());
        List<String> tags = new ArrayList<String>();
        String env = url.getParameter(Constants.TAG_ENVIRONMENT);
        if(env != null) tags.add(env);
        service.setTags(tags);

        return service;
    }
1332105
public static Driver loadDriver(final URL jarUrl) {
        final URLClassLoader driverCl = URLClassLoader.
            newInstance(new URL[] { jarUrl }, null);

        final Iterator<Driver> iter = ServiceLoader.
            load(Driver.class, driverCl).iterator();

        if (!iter.hasNext()) {
            System.err.println("No JDBC driver found: " + jarUrl);
            return null;
        } // end of if

        // ---

        Driver d;
        while (iter.hasNext()) {
            d = iter.next();

            if (driverCl.equals(d.getClass().getClassLoader())) {
                return d; // Ignore driver at system classloader
                // e.g. sun.jdbc.odbc.JdbcOdbcDriver
            } // end of if
        } // end of while

        return null;
    }
803335
public static Sql newInstance(String url) throws SQLException {
        Connection connection = DriverManager.getConnection(url);
        return new Sql(connection);
    }
43959
@NotNull
    @ObjectiveCName("addEndpoint:")
    public ConfigurationBuilder addEndpoint(@NotNull String url) {
        try {
            endpoints.addEndpoint(url);
        } catch (ConnectionEndpointArray.UnknownSchemeException e) {
            throw new RuntimeException(e.getMessage());
        }
        return this;
    }
1280132
public HessianConnection open(URL url)
        throws IOException
    {
        if (log.isLoggable(Level.FINER))
            log.finer(this + " open(" + url + ")");

        URLConnection conn = url.openConnection();

        // HttpURLConnection httpConn = (HttpURLConnection) conn;
        // httpConn.setRequestMethod("POST");
        // conn.setDoInput(true);

        long connectTimeout = _proxyFactory.getConnectTimeout();

        if (connectTimeout >= 0)
            conn.setConnectTimeout((int) connectTimeout);

        conn.setDoOutput(true);

        long readTimeout = _proxyFactory.getReadTimeout();

        if (readTimeout > 0) {
            try {
                conn.setReadTimeout((int) readTimeout);
            } catch (Throwable e) {
            }
        }

        /*
        // Used chunked mode when available, i.e. JDK 1.5.
        if (_proxyFactory.isChunkedPost() && conn instanceof HttpURLConnection) {
          try {
            HttpURLConnection httpConn = (HttpURLConnection) conn;

            httpConn.setChunkedStreamingMode(8 * 1024);
          } catch (Throwable e) {
          }
        }
        */

        return new HessianURLConnection(url, conn);
    }
1148934
public static MavenPluginGeneratedConfigOption mavenConfiguration( String url )
    {
        validateNotEmpty( url, "specified configuration url must not be empty " );
        try
        {
            return mavenConfiguration( new URL( url ) );
        } catch( MalformedURLException mE )
        {
            throw new IllegalArgumentException( "url " + url + " is not a valid url", mE );
        }
    }
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);
        }
    }
639725
public Request createGetRequest(String url, String apiKey, String accessToken) {
        HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
        return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
    }
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"));
    }
969449
public static HttpUrl parse(String url) {
        Builder builder = new Builder();
        Builder.ParseResult result = builder.parse(null, url);
        return result == Builder.ParseResult.SUCCESS ? builder.build() : null;
    }
815361
public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) {
		return new SoapClient(url, protocol, namespaceURI);
	}
308129
private HttpGet prepareGet(final String url) {
    final HttpGet httpGet = new HttpGet(this.instanceUrl + url);
    for (final Header header : this.headers) {
      httpGet.addHeader(header);
    }
    return httpGet;
  }
1110650
public static HttpClient getNewHttpClient(String uri, ClientConnectionManager connectionManager) {
        try {

            HttpParams params = new BasicHttpParams();
            HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
            HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);

            final DefaultHttpClient result = new DefaultHttpClient(
                    connectionManager, params);
            configureProxy(uri, result);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            return new DefaultHttpClient();
        }
    }
348078
protected HttpURLConnection openConnection(String url) throws IOException {
    HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
    connection.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS);
    connection.setReadTimeout(DEFAULT_READ_TIMEOUT_MILLIS);
    connection.setRequestProperty("Content-Type", "application/json");
    connection.setRequestProperty("User-Agent", USER_AGENT);
    connection.setDoInput(true);
    return connection;
  }
885512
public static ServiceDependencyBuilder serviceDependency(final String url) {
        return new ServiceDependencyBuilder()
                .withUrl(url)
                .withType(ServiceDependency.TYPE_SERVICE)
                .withSubtype(ServiceDependency.SUBTYPE_OTHER);
    }