1/*2 * Copyright 2013 The Apache Software Foundation.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package org.apache.juddi.v3.client.mapping;
1718import java.io.IOException;
19import java.security.KeyManagementException;
20import java.security.KeyStoreException;
21import java.security.NoSuchAlgorithmException;
22import java.security.UnrecoverableKeyException;
23import java.security.cert.CertificateException;
24import java.security.cert.X509Certificate;
25import javax.net.ssl.SSLException;
26import javax.net.ssl.SSLSession;
27import javax.net.ssl.SSLSocket;
28import org.apache.http.conn.ssl.SSLSocketFactory;
2930import org.apache.http.conn.ssl.TrustStrategy;
31import org.apache.http.conn.ssl.X509HostnameVerifier;
3233/**34 *35 * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>36 */37publicclassMockSSLSocketFactoryextends SSLSocketFactory {
3839publicMockSSLSocketFactory() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
40super(trustStrategy, hostnameVerifier);
41 }
42privatestaticfinal X509HostnameVerifier hostnameVerifier = new X509HostnameVerifier() {
43//@Override44publicvoid verify(String host, SSLSocket ssl) throws IOException {
45// Do nothing46 }
4748//@Override49publicvoid verify(String host, X509Certificate cert) throws SSLException {
50//Do nothing51 }
5253//@Override54publicvoid verify(String host, String[] cns, String[] subjectAlts) throws SSLException {
55//Do nothing56 }
5758//@Override59publicboolean verify(String s, SSLSession sslSession) {
60returntrue;
61 }
62 };
63privatestaticfinal TrustStrategy trustStrategy = new TrustStrategy() {
64//@Override65publicboolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
66returntrue;
67 }
68 };
69 }