Package org.apache.commons.httpclient.contrib.ssl

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


    }

    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

        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

    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

    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

    /** 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

        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

TOP

Related Classes of org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory

Copyright © 2018 www.massapicom. 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.