001    package org.ujmp.mail;
002    
003    import java.io.IOException;
004    import java.net.InetAddress;
005    import java.net.Socket;
006    
007    import javax.net.SocketFactory;
008    import javax.net.ssl.SSLContext;
009    import javax.net.ssl.SSLSocketFactory;
010    import javax.net.ssl.TrustManager;
011    
012    public class DummySSLSocketFactory extends SSLSocketFactory {
013            private SSLSocketFactory factory;
014    
015            public DummySSLSocketFactory() {
016                    try {
017                            SSLContext sslcontext = SSLContext.getInstance("TLS");
018                            sslcontext.init(null,
019                                            new TrustManager[] { new DummyTrustManager() }, null);
020                            factory = sslcontext.getSocketFactory();
021                    } catch (Exception ex) {
022                            // ignore
023                    }
024            }
025    
026            public static SocketFactory getDefault() {
027                    return new DummySSLSocketFactory();
028            }
029    
030            
031            public Socket createSocket() throws IOException {
032                    return factory.createSocket();
033            }
034    
035            
036            public Socket createSocket(Socket socket, String s, int i, boolean flag)
037                            throws IOException {
038                    return factory.createSocket(socket, s, i, flag);
039            }
040    
041            
042            public Socket createSocket(InetAddress inaddr, int i, InetAddress inaddr1,
043                            int j) throws IOException {
044                    return factory.createSocket(inaddr, i, inaddr1, j);
045            }
046    
047            
048            public Socket createSocket(InetAddress inaddr, int i) throws IOException {
049                    return factory.createSocket(inaddr, i);
050            }
051    
052            
053            public Socket createSocket(String s, int i, InetAddress inaddr, int j)
054                            throws IOException {
055                    return factory.createSocket(s, i, inaddr, j);
056            }
057    
058            
059            public Socket createSocket(String s, int i) throws IOException {
060                    return factory.createSocket(s, i);
061            }
062    
063            
064            public String[] getDefaultCipherSuites() {
065                    return factory.getDefaultCipherSuites();
066            }
067    
068            
069            public String[] getSupportedCipherSuites() {
070                    return factory.getSupportedCipherSuites();
071            }
072    }