Example usage for java.net URISyntaxException getLocalizedMessage

List of usage examples for java.net URISyntaxException getLocalizedMessage

Introduction

In this page you can find the example usage for java.net URISyntaxException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.deegree.portal.standard.wfs.control.DigitizeListener.java

/**
 * The FEATURE_TYPE passed in the rpc must be given with namespace and featuretype name in the
 * form: {http://some.address.com}:featureTypeName. This string gets extracted from the rpc and
 * transformed into a <code>QualifiedName</code>.
 *
 * @param rpcEvent/*from   w w  w  . j av  a2 s  . c om*/
 * @return the QualifiedNames for the featureType in the passed rpcEvent
 * @throws WFSClientException
 *             if featureType cannot be transformed to a <code>QualifiedName</code>.
 */
protected QualifiedName extractFeatureTypeAsQualifiedName(RPCWebEvent rpcEvent) throws WFSClientException {

    RPCParameter[] params = rpcEvent.getRPCMethodCall().getParameters();
    String featureType = (String) params[0].getValue();

    String ns = featureType.substring((1 + featureType.indexOf("{")), featureType.indexOf("}:"));
    String ftName = featureType.substring(2 + featureType.indexOf("}:"));

    try {
        return new QualifiedName(null, ftName, new URI(ns));
    } catch (URISyntaxException e) {
        LOG.logError(e.getLocalizedMessage());
        throw new WFSClientException(Messages.getMessage("IGEO_STD_WFS_INVALID_NS", featureType, ns));
    }
}

From source file:com.android.im.imps.HttpDataChannel.java

/**
 * Constructs a new HttpDataChannel for a connection.
 *
 * @param connection the connection which uses the data channel.
 *///from ww  w. j  a  va  2  s  .c  o  m
public HttpDataChannel(ImpsConnection connection) throws ImException {
    super(connection);
    mTxManager = connection.getTransactionManager();
    ImpsConnectionConfig cfg = connection.getConfig();
    try {
        String host = cfg.getHost();
        if (host == null || host.length() == 0) {
            throw new ImException(ImErrorInfo.INVALID_HOST_NAME, "Empty host name.");
        }
        mPostUri = new URI(cfg.getHost());
        if (mPostUri.getPath() == null || "".equals(mPostUri.getPath())) {
            mPostUri = new URI(cfg.getHost() + "/");
        }
        if (!"http".equalsIgnoreCase(mPostUri.getScheme()) && !"https".equalsIgnoreCase(mPostUri.getScheme())) {
            throw new ImException(ImErrorInfo.INVALID_HOST_NAME, "Non HTTP/HTTPS host name.");
        }

        mHttpClient = AndroidHttpClient.newInstance("Android-Imps/0.1");

        HttpParams params = mHttpClient.getParams();
        HttpConnectionParams.setConnectionTimeout(params, cfg.getReplyTimeout());
        HttpConnectionParams.setSoTimeout(params, cfg.getReplyTimeout());
    } catch (URISyntaxException e) {
        throw new ImException(ImErrorInfo.INVALID_HOST_NAME, e.getLocalizedMessage());
    }

    mContentTypeHeader = new BasicHeader("Content-Type", cfg.getTransportContentType());
    String msisdn = cfg.getMsisdn();
    mMsisdnHeader = (msisdn != null) ? new BasicHeader("MSISDN", msisdn) : null;

    mParser = cfg.createPrimitiveParser();
    mSerializer = cfg.createPrimitiveSerializer();
}

From source file:com.da.daum.DaumCafeBungImgList.java

private String execGetUrl(HttpClient httpclient, String p_url) throws IOException, ClientProtocolException {
    String ret = "";
    HttpGet httpget = new HttpGet(p_url);
    ResponseHandler<String> responseHandler = new BasicResponseHandler();

    try {/* w  w  w.jav a 2s. co m*/
        httpget.setURI(new URI(p_url));
        ret = httpclient.execute(httpget, responseHandler);

    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        System.out.println(e.getLocalizedMessage());

    }

    return ret;
}

From source file:com.visionspace.jenkins.vstart.plugin.VSPluginPerformer.java

public boolean validateTestCase(Long id, AbstractBuild build, BuildListener listener) {
    try {/*from   ww  w. j a v a  2s  .co  m*/
        if (!vstObject.canRun(id)) {
            listener.getLogger().println("This job can't be run at the moment. [JOB: "
                    + build.getProject().getName() + " BUILD NO " + build.getNumber() + "]);");
            return false;
        } else {
            return true;
        }
    } catch (URISyntaxException ex) {
        Logger.getLogger(VSPluginPerformer.class.getName()).log(Level.SEVERE, null, ex);
        listener.getLogger().println("Exception during the test case validation -> " + ex.getReason());
        return false;
    } catch (IOException ex) {
        Logger.getLogger(VSPluginPerformer.class.getName()).log(Level.SEVERE, null, ex);
        listener.getLogger().println("Exception during the VSTART run! -> " + ex.getLocalizedMessage());
        return false;
    }
}

From source file:org.eclipse.orion.server.docker.servlets.DockerHandler.java

private void initDockerServer() {
    try {//from  ww w . jav a 2s . c  om
        String dockerLocation = PreferenceHelper.getString(ServerConstants.CONFIG_DOCKER_URI, "none") //$NON-NLS-1$
                .toLowerCase();
        if ("none".equals(dockerLocation)) {
            // there is no docker URI value in the orion.conf, try using a default
            dockerLocation = "http://localhost:4243";
            if (logger.isWarnEnabled()) {
                logger.warn("No Docker Server specified by \"" + ServerConstants.CONFIG_DOCKER_URI
                        + "\" in orion.conf, trying " + dockerLocation);
            }
        }
        if (!OrionConfiguration.getMetaStorePreference().equals(ServerConstants.CONFIG_META_STORE_SIMPLE_V2)) {
            // the docker feature requires version two of the simple metadata storage, so no docker support
            dockerServer = null;
            logger.error(
                    "Docker Support requires version two of the simple metadata storage, see https://wiki.eclipse.org/Orion/Metadata_migration to migrate to the current version");
            return;
        }
        URI dockerLocationURI = new URI(dockerLocation);
        URI dockerProxyURI = dockerLocationURI;

        String dockerProxy = PreferenceHelper.getString(ServerConstants.CONFIG_DOCKER_PROXY_URI, "none") //$NON-NLS-1$
                .toLowerCase();
        if (!"none".equals(dockerProxy)) {
            // there is a docker proxy URI value in the orion.conf
            dockerProxyURI = new URI(dockerProxy);
            if (logger.isDebugEnabled()) {
                logger.debug("Docker Proxy Server " + dockerProxy + " is enabled");
            }
        }

        String portStart = PreferenceHelper.getString(ServerConstants.CONFIG_DOCKER_PORT_START, "none") //$NON-NLS-1$
                .toLowerCase();
        String portEnd = PreferenceHelper.getString(ServerConstants.CONFIG_DOCKER_PORT_END, "none") //$NON-NLS-1$
                .toLowerCase();
        if ("none".equals(portStart) || "none".equals(portEnd)) {
            // there is a no docker port start value in the orion.conf
            portStart = null;
            portEnd = null;
            if (logger.isInfoEnabled()) {
                logger.info(
                        "Docker Server does not have port mapping enabled, start and end host ports not specified");
            }
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "Docker Server using ports " + portStart + " to " + portEnd + " for host port mapping");
            }
        }

        String userId = PreferenceHelper.getString(ServerConstants.CONFIG_DOCKER_UID, "1000").toLowerCase(); //$NON-NLS-1$
        if (logger.isDebugEnabled()) {
            logger.debug("Orion Server running as UID " + userId);
        }

        String groupId = PreferenceHelper.getString(ServerConstants.CONFIG_DOCKER_GID, "1000").toLowerCase(); //$NON-NLS-1$
        if (logger.isDebugEnabled()) {
            logger.debug("Orion Server running as GID " + groupId);
        }

        dockerServer = new DockerServer(dockerLocationURI, dockerProxyURI, portStart, portEnd, userId, groupId);
        DockerVersion dockerVersion = dockerServer.getDockerVersion();
        if (logger.isDebugEnabled()) {
            if (dockerVersion.getStatusCode() != DockerResponse.StatusCode.OK) {
                logger.error("Cound not connect to docker server " + dockerLocation + ": "
                        + dockerVersion.getStatusMessage());
            } else {
                if (logger.isInfoEnabled()) {
                    logger.info("Docker Server " + dockerLocation + " is running version "
                            + dockerVersion.getVersion());
                }
            }
        }

    } catch (URISyntaxException e) {
        logger.error(e.getLocalizedMessage(), e);
        dockerServer = null;
    }
}

From source file:net.es.sense.rm.api.SenseRmController.java

/**
 * ***********************************************************************
 * POST /api/sense/v1/models/{id}/deltas
 *
 * *********************************************************************** @param accept
 * @param accept/*from ww w  .java  2s  . c o m*/
 * @param deltaRequest
 * @param model
 * @param id
 * @return
 */
@ApiOperation(value = "Submits a proposed model delta to the Resource Manager based on the model identified by id.", notes = "The Resource Manager must verify the proposed model change, confirming (201 Created), rejecting (500 Internal Server Error), or proposing an optional counter-offer (200 OK).", response = DeltaResource.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpConstants.OK_CODE, message = HttpConstants.OK_DELTA_COUNTER_MSG, response = DeltaRequest.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class),
                @ResponseHeader(name = HttpConstants.LAST_MODIFIED_NAME, description = HttpConstants.LAST_MODIFIED_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.CREATED_CODE, message = HttpConstants.CREATED_MSG, response = DeltaResource.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class),
                @ResponseHeader(name = HttpConstants.LAST_MODIFIED_NAME, description = HttpConstants.LAST_MODIFIED_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.BAD_REQUEST_CODE, message = HttpConstants.BAD_REQUEST_MSG, response = Error.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.FORBIDDEN_CODE, message = HttpConstants.FORBIDDEN_MSG, response = Error.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.NOT_FOUND_CODE, message = HttpConstants.NOT_FOUND_MSG, response = Error.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.NOT_ACCEPTABLE_CODE, message = HttpConstants.NOT_ACCEPTABLE_MSG, response = Error.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.CONFLICT_CODE, message = HttpConstants.CONFLICT_MSG, response = Error.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class) }),
        @ApiResponse(code = HttpConstants.INTERNAL_ERROR_CODE, message = HttpConstants.INTERNAL_ERROR_MSG, response = Error.class, responseHeaders = {
                @ResponseHeader(name = HttpConstants.CONTENT_TYPE_NAME, description = HttpConstants.CONTENT_TYPE_DESC, response = String.class) }), })
@RequestMapping(value = "/models/{" + HttpConstants.ID_NAME
        + "}/deltas", method = RequestMethod.POST, consumes = {
                MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<?> propagateModelDelta(
        @RequestHeader(value = HttpConstants.ACCEPT_NAME, defaultValue = MediaType.APPLICATION_JSON_VALUE) @ApiParam(value = HttpConstants.ACCEPT_MSG, required = false) String accept,
        @RequestParam(value = HttpConstants.MODEL_NAME, defaultValue = HttpConstants.MODEL_TURTLE) @ApiParam(value = HttpConstants.MODEL_MSG, required = false) String model,
        @PathVariable(HttpConstants.ID_NAME) @ApiParam(value = HttpConstants.ID_MSG, required = true) String id,
        @RequestBody @ApiParam(value = "A JSON structure-containing the model reduction and/or addition "
                + " elements. If provided, the model reduction element is applied first, "
                + " followed by the model addition element.", required = true) DeltaRequest deltaRequest) {

    log.info("propagateModelDelta: {}", deltaRequest);

    DeltaResource delta = new DeltaResource();
    delta.setId("922f4388-c8f6-4014-b6ce-5482289b0200");
    delta.setHref("http://localhost:8080/sense/v1/deltas/922f4388-c8f6-4014-b6ce-5482289b0200");
    delta.setLastModified("2016-07-26T13:45:21.001Z");
    delta.setModelId("922f4388-c8f6-4014-b6ce-5482289b02ff");
    delta.setResult(
            "H4sIACKIo1cAA+1Y32/aMBB+56+I6NtUx0loVZEV1K6bpkm0m5Y+7NWNTbCa2JEdCP3vZydULYUEh0CnQXlC+O6+O/ u7X1ylgozp3BJ4LH3rcpJlqQ9hnud23rO5iKDnOA50XKgEgAwnJEEnQ8vuXC30eB5XqXnQuYDqfEl+LnGVvAv/3I6CVQiFv FbF7ff7UKF4Hiice2IZmgMml5RZ8sq/0n9p82hcWFCHCtjtQacHH5AkS5qJkNWa6rDUdD2Y8ZTHPHoqtDudy6lgvpLzGclyL h59zBNE2YBIW/0y7FhvPqjw8X5h5LS40TuUEPyDYTqjeIpi6/OKltZ5IDFnkbzn1gqmxMxO0DyiEUp5qoGfj4YVxiZIfqGYCh JmlDMU/+IiW7W7FIvPOCYDOWUMhOLcT5XG4AJ60PVjyh4HKPbk8NTIBmIxSIRXmpgT4EAXOqWVT4YmwgkNX9w4V wZeu1EddEDEjIZkE4YyktNMgbCoyhhTj2Z1vwVK3PoZ3Fz/DqyvN3ddTYoq49o3bd6mLCNCffFsgqeHwZH1sS04gxmQua 3fbI1I8YIkm5xDr3xCInXmVPPAAEqztAaqtwQFtHQ7vBzJiQmeeoAW5KxwxJisP57VrOuRF2xB1ZZ37M9ixIBALCLrSG9ct 0dI8fy74NN02CQ5Yq2WPaVkE5KqaQ5UIRRRnWinq+51huIpkVbXA2dO/6ztjTZhUUXRWEnYHVUPcwY2zaOafHh553fKz dcErXCLyuuYIlnpEBYo4quVVvtzezO6K2Fd0AMG/arMWuoBLQTcWnqZ9tcNOahhX679/8muNX27IrrgWWBRbZvESFjIsV LdXYhHOYcVVAlylKb6LrtjFEvStnY2Gi4ONAn2Mxh9dJr3mYi2bDjmRWHHXaYe7N+wZk0b2FTH2rHC+EJ28NL7Se9aVp Ry9ZwwyNTDa8Uf627LdXcfM8CWk/4BTQBblaMDjb92ND2C+Gun+yNsz6ZbcdPuLBSQfLvwJ1QggDPmF6Uo5IyVt+rnCq es+AaNt7cbsh/jaxtn//6GsWYDgAEdvHddkj8Wv/3/+bCDnW+rf2DW7Xx/ASQO0KQcHgAA");
    URI deltaURI;
    try {
        deltaURI = new URI("http://localhost:8080/sense/v1/deltas/922f4388-c8f6-4014-b6ce-5482289b0200");
    } catch (URISyntaxException ex) {
        Error error = new Error(HttpStatus.INTERNAL_SERVER_ERROR.toString(), ex.getLocalizedMessage(), null);
        return new ResponseEntity<>(error, null, HttpStatus.INTERNAL_SERVER_ERROR);
    }

    final URI location = ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri();

    log.error("URL: " + location.toASCIIString());

    //return Response.created(deltaURI).entity(getProxy().serialize(delta)).build();
    final HttpHeaders headers = new HttpHeaders();
    headers.setLocation(deltaURI);
    return new ResponseEntity<>(delta, headers, HttpStatus.CREATED);
}

From source file:edu.mit.mobile.android.locast.net.NetworkClient.java

private void setBaseUrl(String baseUrlString) throws MalformedURLException {
    final URL baseUrl = new URL(baseUrlString);
    try {//from w  w  w  .j a va 2s .  com
        mBaseUrl = baseUrl.toURI();

        mAuthScope = new AuthScope(mBaseUrl.getHost(), mBaseUrl.getPort());

    } catch (final URISyntaxException e) {
        final MalformedURLException me = new MalformedURLException(e.getLocalizedMessage());
        me.initCause(e);
        throw me;
    }
}

From source file:pcgen.core.SettingsHandler.java

/**
 * Retreive the chosen campaign files from properties for
 * use by the rest of PCGen.//from  w  w  w.  ja v a2 s . c o  m
 * 
 * @param gameMode The GameMode to reteieve the files for.
 */
private static void getChosenCampaignFiles(GameMode gameMode) {
    List<String> uriStringList = CoreUtility
            .split(getOptions().getProperty("pcgen.files.chosenCampaignSourcefiles." + gameMode.getName(), //$NON-NLS-1$
                    ""), ',');
    List<URI> uriList = new ArrayList<>(uriStringList.size());
    for (String str : uriStringList) {
        try {
            uriList.add(new URI(str));
        } catch (URISyntaxException e) {
            Logging.errorPrint(
                    "Settings error: Unable to convert " + str + " to a URI: " + e.getLocalizedMessage());
        }
    }
    PersistenceManager.getInstance().setChosenCampaignSourcefiles(uriList, gameMode);
}

From source file:com.microsoft.tfs.core.TFSConnection.java

/**
 * Creates a {@link TFSConnection}. Both a {@link URI} and a
 * {@link ConnectionAdvisor} are specified.
 * <p>//from ww  w . j a va  2 s. c o  m
 * The URI in the profile must be the fully qualified URI to the server; it
 * should not point to a project collection.
 *
 * @param serverURI
 *        the {@link URI} to connect to (must not be <code>null</code>).
 *        This URI must be properly URI encoded.
 * @param credentialsHolder
 *        an {@link AtomicReference} to the {@link Credentials} to connect
 *        with (must not be <code>null</code>)
 * @param advisor
 *        the {@link ConnectionAdvisor} to use (must not be
 *        <code>null</code>)
 * @param locationServiceRelativePath
 *        the URI path (relative to the scheme, host, and port of the main
 *        URI computed from the profile data) where the location service can
 *        be reached for this connection (must not be <code>null</code> or
 *        empty)
 */
protected TFSConnection(URI serverURI, final AtomicReference<Credentials> credentialsHolder,
        final ConnectionAdvisor advisor, final String locationServiceRelativePath) {
    Check.notNull(serverURI, "serverURI"); //$NON-NLS-1$
    Check.notNull(advisor, "advisor"); //$NON-NLS-1$
    Check.notNullOrEmpty(locationServiceRelativePath, "locationServiceRelativePath"); //$NON-NLS-1$

    this.locationServiceRelativePath = locationServiceRelativePath;

    /*
     * Build a new server URL in the short format.
     *
     * getBaseURI() must use a similar rewrite rule because it defers to the
     * ConnectionAdvisor's URI provider, which may decide to return a
     * different URI even though the server URL has already been shortened.
     */
    final String serverURIShortFormat = serverURI.toString();
    if (serverURIShortFormat != null
            && serverURIShortFormat.toLowerCase().endsWith(this.locationServiceRelativePath.toLowerCase())) {
        try {
            /*
             * Note that the input URI is literal (already encoded, if
             * necessary) so we use the URI ctor instead of URIUtils#newURI
             * method (which would doubly encode).
             */
            serverURI = new URI(serverURIShortFormat.substring(0,
                    serverURIShortFormat.length() - this.locationServiceRelativePath.length()));
        } catch (final URISyntaxException e) {
            throw new IllegalArgumentException(e.getLocalizedMessage(), e);
        }
    }

    this.advisor = advisor;

    this.sessionId = GUID.newGUID();
    this.instanceData = new ConnectionInstanceData(serverURI, credentialsHolder, sessionId);

    if (log.isDebugEnabled()) {
        log.debug(MessageFormat.format("Created a new TFSConnection, sessionId: [{0}], server URI: [{1}]", //$NON-NLS-1$
                sessionId, serverURI));
    }

    shutdownEventListener = new ShutdownEventListener() {
        final Throwable creationStack = isSDK() ? new Throwable(
                "The TFSConnection was closed during JVM shutdown because it was not properly closed by the creator.  The creator of the TFSConnection should close the connection when finished with it.") //$NON-NLS-1$
                : null;

        @Override
        public void onShutdown() {
            if (isClosed()) {
                /**
                 * During shutdown it is possible for
                 * TFSConfigurationServers to be closed by their owning
                 * TFSTeamProjectCollections, but the shutdown listener is
                 * already iterating, so it will attempt to close it again;
                 * we don't want this.
                 */
                return;
            }
            if (creationStack != null) {
                /**
                 * Warn SDK users that they should have closed the
                 * connection.
                 */
                log.warn(creationStack.getMessage(), creationStack);
            }
            log.debug("Shutdown: close TFSConnection."); //$NON-NLS-1$
            close();
            log.debug("Shutdown: TFSCconnection closed."); //$NON-NLS-1$
        }
    };
    ShutdownManager.getInstance().addShutdownEventListener(shutdownEventListener, Priority.MIDDLE);

    /* Preview expiration enforcement */
    // checkPreviewExpiration();
}

From source file:com.photon.phresco.framework.impl.SCMManagerImpl.java

void additionalAuthentication(String passPhrase) {
    final String passwordPhrase = passPhrase;
    JschConfigSessionFactory sessionFactory = new JschConfigSessionFactory() {
        @Override//w  w w  .j  a  va 2s.  co  m
        protected void configure(OpenSshConfig.Host hc, Session session) {
            CredentialsProvider provider = new CredentialsProvider() {
                @Override
                public boolean isInteractive() {
                    return false;
                }

                @Override
                public boolean supports(CredentialItem... items) {
                    return true;
                }

                @Override
                public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
                    for (CredentialItem item : items) {
                        if (item instanceof CredentialItem.StringType) {
                            ((CredentialItem.StringType) item).setValue(passwordPhrase);
                        }
                    }
                    return true;
                }
            };
            UserInfo userInfo = new CredentialsProviderUserInfo(session, provider);
            // Unknown host key for ssh
            java.util.Properties config = new java.util.Properties();
            config.put(STRICT_HOST_KEY_CHECKING, NO);
            session.setConfig(config);

            session.setUserInfo(userInfo);
        }
    };

    SshSessionFactory.setInstance(sessionFactory);

    /*
     * Enable clone of https url by trusting those urls
     */
    // Create a trust manager that does not validate certificate chains
    TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
            return null;
        }

        public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
        }

        public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
        }
    } };

    final String https_proxy = System.getenv(HTTPS_PROXY);
    final String http_proxy = System.getenv(HTTP_PROXY);

    ProxySelector.setDefault(new ProxySelector() {
        final ProxySelector delegate = ProxySelector.getDefault();

        @Override
        public List<Proxy> select(URI uri) {
            // Filter the URIs to be proxied

            if (uri.toString().contains(HTTPS) && StringUtils.isNotEmpty(http_proxy) && http_proxy != null) {
                try {
                    URI httpsUri = new URI(https_proxy);
                    String host = httpsUri.getHost();
                    int port = httpsUri.getPort();
                    return Arrays.asList(new Proxy(Type.HTTP, InetSocketAddress.createUnresolved(host, port)));
                } catch (URISyntaxException e) {
                    if (debugEnabled) {
                        S_LOGGER.debug("Url exception caught in https block of additionalAuthentication()");
                    }
                }
            }

            if (uri.toString().contains(HTTP) && StringUtils.isNotEmpty(http_proxy) && http_proxy != null) {
                try {
                    URI httpUri = new URI(http_proxy);
                    String host = httpUri.getHost();
                    int port = httpUri.getPort();
                    return Arrays.asList(new Proxy(Type.HTTP, InetSocketAddress.createUnresolved(host, port)));
                } catch (URISyntaxException e) {
                    if (debugEnabled) {
                        S_LOGGER.debug("Url exception caught in http block of additionalAuthentication()");
                    }
                }
            }

            // revert to the default behaviour
            return delegate == null ? Arrays.asList(Proxy.NO_PROXY) : delegate.select(uri);
        }

        @Override
        public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
            if (uri == null || sa == null || ioe == null) {
                throw new IllegalArgumentException("Arguments can't be null.");
            }
        }
    });

    // Install the all-trusting trust manager
    try {
        SSLContext sc = SSLContext.getInstance(SSL);
        sc.init(null, trustAllCerts, new java.security.SecureRandom());
        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
    } catch (GeneralSecurityException e) {
        e.getLocalizedMessage();
    }
}