Examples of TrustStrategy


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

        return new DefaultHttpClient(connectionManager);
    }

    private SchemeRegistry createTrustEveryoneRegistry(int sslPort) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
        TrustStrategy easyStrategy = new TrustStrategy() {

            @Override
            public boolean isTrusted(X509Certificate[] certificate, String authType)
                    throws CertificateException {
                return true;
View Full Code Here

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

   private String readDistroManifest() throws Exception {
      BufferedReader in = null;
      DefaultHttpClient httpclient = new DefaultHttpClient();

      try {
         TrustStrategy trustStrategy = new TrustStrategy() {
            @Override
            public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
               return true;
            }
         };
View Full Code Here

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

                        .setSoTimeout((int) TimeUnit.SECONDS.toMillis(4))
                        .build())
                .setSslcontext(
                        SSLContexts
                                .custom()
                                .loadTrustMaterial(trustStore, new TrustStrategy() {
                                    public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                                        return true;
                                    }
                                })
                                .build()
View Full Code Here

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

   * @return
   */
  private HttpClient getHttpClient() {
    try {
      // ClientConnectionManager
      SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy() {
        public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
          return true;
        }
      }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

View Full Code Here

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

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

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

public class ApacheHttpClient {
  static DefaultHttpClient httpClient = null;

  private ApacheHttpClient() throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException{
    // Allow self-signed SSL certificates:
    TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    SSLSocketFactory sslSf = new SSLSocketFactory(trustStrategy,
          hostnameVerifier);
    Scheme https = new Scheme("https", 443, sslSf);
View Full Code Here

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

 
  private ApacheHttpClient() throws KeyManagementException,
      UnrecoverableKeyException, NoSuchAlgorithmException,
      KeyStoreException {
    // Allow self-signed SSL certificates:
    TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    SSLSocketFactory sslSf = new SSLSocketFactory(trustStrategy,
        hostnameVerifier);
    Scheme https = new Scheme("https", 443, sslSf);
   
View Full Code Here

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

        s_logger.debug("POST request to " + agentUri.toString()
                + " with contents " + logMessage);

        // Create request
        HttpClient httpClient = null;
        TrustStrategy easyStrategy = new TrustStrategy() {
            @Override
            public boolean isTrusted(X509Certificate[] chain, String authType)
                    throws CertificateException {
                return true;
            }
View Full Code Here

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

        HttpClient httpClient = new DefaultHttpClient(new PoolingClientConnectionManager());
        HttpClientParams.setRedirecting(httpClient.getParams(), false);
        HttpClientParams.setCookiePolicy(httpClient.getParams(), CookiePolicy.IGNORE_COOKIES);

        //trust all ssl.
        SSLSocketFactory sslsf = new SSLSocketFactory(new TrustStrategy() {
            public boolean isTrusted(
                    final X509Certificate[] chain, String authType) throws java.security.cert.CertificateException {
                return true;
            }
        });
View Full Code Here

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

    }

    @SuppressWarnings("deprecation")
    @Test
    public final void givenHttpClientPre4_3_whenAcceptingAllCertificates_thenCanConsumeHttpsUriWithSelfSignedCertificate() throws IOException, GeneralSecurityException {
        final TrustStrategy acceptingTrustStrategy = new TrustStrategy() {
            @Override
            public final boolean isTrusted(final X509Certificate[] certificate, final String authType) {
                return true;
            }
        };
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.