Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2011 ConnId (connid-dev@googlegroups.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.connid.bundles.ad.util;
public class TrustAllSocketFactory extends SSLSocketFactory {
    private static final Log LOG = Log.getLog(TrustAllSocketFactory.class);
    public TrustAllSocketFactory() {
        try {
            final SSLContext ctx = SSLContext.getInstance("TLS");
            ctx.init(
                    null,
                    new TrustManager[]{new TrustAllTrustManager()},
                    new SecureRandom());
             = ctx.getSocketFactory();
        } catch (Exception e) {
            .error(e"Error initializing SSL context");
        }
    }
    public static SocketFactory getDefault() {
        return new TrustAllSocketFactory();
    }
    @Override
    public String[] getDefaultCipherSuites() {
        return .getDefaultCipherSuites();
    }
    @Override
    public String[] getSupportedCipherSuites() {
        return .getSupportedCipherSuites();
    }
    @Override
    public Socket createSocket(
            final Socket socketfinal String stringfinal int ifinal boolean bln)
            throws IOException {
        return .createSocket(socketstringibln);
    }
    @Override
    public Socket createSocket(final String stringfinal int i)
            throws IOExceptionUnknownHostException {
        return .createSocket(stringi);
    }
    @Override
    public Socket createSocket(
            final String stringfinal int ifinal InetAddress iafinal int i1)
            throws IOExceptionUnknownHostException {
        return .createSocket(stringiiai1);
    }
    @Override
    public Socket createSocket(final InetAddress iafinal int i)
            throws IOException {
        return .createSocket(iai);
    }
    @Override
    public Socket createSocket(
            final InetAddress iafinal int ifinal InetAddress ia1final int i1)
            throws IOException {
        return .createSocket(iaiia1i1);
    }
New to GrepCode? Check out our FAQ X