Examples of TrustSelfSignedStrategy


Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    keyStore.load(new FileInputStream(new File("src/test/resources/test.jks")),
        "secret".toCharArray());

    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder()
            .loadTrustMaterial(null, new TrustSelfSignedStrategy())
            .loadKeyMaterial(keyStore, "password".toCharArray()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    this.container = factory.getEmbeddedServletContainer();
    this.container.start();

    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder().loadTrustMaterial(null,
            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    keyStore.load(new FileInputStream(new File("src/test/resources/test.jks")),
        "secret".toCharArray());

    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder()
            .loadTrustMaterial(null, new TrustSelfSignedStrategy())
            .loadKeyMaterial(keyStore, "password".toCharArray()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    this.container = factory.getEmbeddedServletContainer();
    this.container.start();

    SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
        new SSLContextBuilder().loadTrustMaterial(null,
            new TrustSelfSignedStrategy()).build());

    HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
        .build();

    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    // install host name verifier that always approves host names
    AllowAllHostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    // for SSL requests we should accept self-signed host certificates
    KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
    SSLContext sslContext = SSLContexts.custom()
        .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())
        .build();
    CloseableHttpClient httpclient = HttpClients.custom()
        .setDefaultRequestConfig(this.requestConfig)
        .setSslcontext(sslContext)
        .setHostnameVerifier(hostnameVerifier).build();
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    // install host name verifier that always approves host names
    AllowAllHostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    // for SSL requests we should accept self-signed host certificates
    KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
    SSLContextBuilder sslContextBuilder = SSLContexts.custom()
        .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy());

    // first attempt to prepare a https client with certificate credentials
    if (this.certificateCredentials != null) {
      String keystorePath = this.certificateCredentials.getKeystorePath();
      String keystorePassword = this.certificateCredentials
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    AllowAllHostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    // for SSL requests we should accept self-signed host certificates

    KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
    SSLContext sslContext = SSLContexts.custom()
        .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())
        .build();
    CloseableHttpClient httpclient = HttpClients.custom()
        .setDefaultRequestConfig(this.requestConfig)
        .setSslcontext(sslContext)
        .setHostnameVerifier(hostnameVerifier).build();
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    final HttpClientBuilder builder = HttpClientBuilder.create();
   
    // Allow self-signed SSL certificates:
    try {
      final SSLContextBuilder sslbuilder = new SSLContextBuilder();
      sslbuilder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
      final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
          sslbuilder.build(),
          SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
     
      builder.setSSLSocketFactory(sslsf);
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    private static CloseableHttpClient createHttpsClient() {
        CloseableHttpClient chc = null;
        try {
            final SSLContextBuilder builder = new SSLContextBuilder();
            builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
            chc = HttpClients.custom().setSSLSocketFactory(
                    new SSLConnectionSocketFactory(builder.build(),
                            SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)).build();
        } catch (KeyManagementException ex) {
        } catch (NoSuchAlgorithmException ex) {
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

   * @throws KeyStoreException the key store exception
   */
  private ApacheHttpClient() {
   
    // Allow self-signed SSL certificates:
    final TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    final X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    final SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();

    SSLSocketFactory sslSf;
    try {
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.