Examples of EasySSLProtocolSocketFactory


Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

    private HttpClient createAndInitHttpClient(String characterEncoding, boolean selfSignedSSL) {
       
        if (selfSignedSSL) {
            Protocol.registerProtocol("https",
                    new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
        }
       
        HttpClient httpClient = new HttpClient();
        httpClient.getParams().setBooleanParameter("http.protocol.allow-circular-redirects", true);
        httpClient.getParams().setConnectionManagerTimeout(CONNECTION_TIMEOUT_INTERVAL);
View Full Code Here

Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

    }

    if (isTrusted(host)) {
      // creating a special configuration that allows connections to non-trusted HTTPS hosts
      // see the javadoc to EasySSLProtocolSocketFactory for details
      Protocol easyHttps = new Protocol("https", (ProtocolSocketFactory)new EasySSLProtocolSocketFactory(), 443);
      HostConfiguration hc = new HostConfiguration();
      hc.setHost(host, 443, easyHttps);
      String relativeUri = new URI(uri.getPathQuery(), false).getURI();
      // it is important to use relative URI here, otherwise our custom protocol won't work.
      // we have to recreate the method, because HttpMethod#setUri won't overwrite the host,
View Full Code Here

Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

        return verifySuccess(response);
    }

    private String sendRequest(String service, String xmlRequest) throws ExecutionException {
        org.apache.commons.httpclient.protocol.Protocol myhttps =
                new org.apache.commons.httpclient.protocol.Protocol("https", new EasySSLProtocolSocketFactory(), 443);
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(_ip, 443, myhttps);
        byte[] response = null;
        PostMethod method = new PostMethod("/xmlIM/" + service);
       
View Full Code Here

Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

    if( StringUtils.isNullOrEmpty( sslConfig ) )
    {
      return enableSocket( ( SSLSocket )super.createSocket( host, port, localAddress, localPort, params ) );
    }

    EasySSLProtocolSocketFactory factory = factoryMap.get( sslConfig );
    if( factory != null )
    {
      return enableSocket( ( SSLSocket )factory.createSocket( host, port, localAddress, localPort, params ) );
    }
    try
    {
      // try to create new factory for specified config
      factory = new EasySSLProtocolSocketFactory();

      int ix = sslConfig.lastIndexOf( ' ' );
      String keyStore = sslConfig.substring( 0, ix );
      String pwd = sslConfig.substring( ix + 1 );

      factory.setKeyMaterial( new KeyMaterial( keyStore, pwd.toCharArray() ) );
      factoryMap.put( sslConfig, factory );

      return enableSocket( ( SSLSocket )factory.createSocket( host, port, localAddress, localPort, params ) );
    }
    catch( Exception gse )
    {
      SoapUI.logError( gse );
      return enableSocket( ( SSLSocket )super.createSocket( host, port, localAddress, localPort, params ) );
View Full Code Here

Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

    bind(GatewayConfiguration.class).in(Singleton.class);
  }

  @Provides @Singleton HttpClient provideHttpClient() {
    Protocol.registerProtocol("https",
        new Protocol("https", (ProtocolSocketFactory) new EasySSLProtocolSocketFactory(), 443));
    MultiThreadedHttpConnectionManager manager = new MultiThreadedHttpConnectionManager();
    manager.getParams().setDefaultMaxConnectionsPerHost(20);
    manager.getParams().setMaxTotalConnections(200);
    HttpClient client = new HttpClient(manager);
    client.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
View Full Code Here

Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

    /** Creates a new instance of Web */
    public Web() {
    }
   
    public static String grabHTTPSPage(String host, String page, HttpMethod method) throws IOException{
        Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(host, 443, easyhttps);
        client.executeMethod(method);
        return method.getResponseBodyAsString();
    }
View Full Code Here

Examples of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

        String response = sendRequest(service, xml);
        return verifySuccess(response);
    }

    private String sendRequest(String service, String xmlRequest) throws ExecutionException {
        org.apache.commons.httpclient.protocol.Protocol myhttps = new org.apache.commons.httpclient.protocol.Protocol("https", new EasySSLProtocolSocketFactory(), 443);
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(_ip, 443, myhttps);
        byte[] response = null;
        PostMethod method = new PostMethod("/xmlIM/" + service);
View Full Code Here

Examples of ucar.nc2.util.net.EasySSLProtocolSocketFactory

    private String getURLContentWithGetMethod(String urlToClip, RenderContext renderContext, Resource resource, RenderChain chain, Map map) throws IOException {
        String path = urlToClip;
        Map parameters = (Map) map.get("URL_PARAMS");
        // Get the httpClient
        HttpClient httpClient = new HttpClient();
        Protocol.registerProtocol("https", new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
        httpClient.getParams().setContentCharset("UTF-8");
        //
        // Add parameters
        if (parameters != null) {
            StringBuffer params = new StringBuffer(4096);
View Full Code Here

Examples of ucar.nc2.util.net.EasySSLProtocolSocketFactory

    private String getURLContentWithPostMethod(String urlToClip, RenderContext renderContext, Resource resource, RenderChain chain, Map map) {
        String path = urlToClip;
        Map parameters = (Map) map.get("URL_PARAMS");
        // Get the httpClient
        HttpClient httpClient = new HttpClient();
        Protocol.registerProtocol("https", new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
        httpClient.getParams().setContentCharset("UTF-8");
        // Create a post method for accessing the url.
        PostMethod postMethod = new PostMethod(path);
        // Set a default retry handler (see httpclient doc).
        postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.