1package org.apache.harmony.xnet.tests.support;
2
3import javax.net.ssl.SSLSocketFactory;
4
5import java.net.InetAddress;
6import java.net.Socket;
7import java.io.IOException;
8import java.net.UnknownHostException;
9
10
11public class SSLSocketFactoryImpl extends SSLSocketFactory {
12
13    public SSLSocketFactoryImpl() {
14        super();
15    }
16
17    public Socket createSocket(Socket socket, String s, int i, boolean flag)
18                               throws IOException {
19        if (socket == null) {
20            throw new IOException("incorrect socket");
21        }
22        if (i < 0 || i > 65535) {
23            throw new IOException("incorrect port");
24        }
25        if (s == null || s.equals("")) {
26            throw new UnknownHostException("incorrect host");
27        }
28
29        if (!flag) {
30            socket = new Socket(s, i);
31        } else {
32            socket = new Socket(s, i);
33            socket.close();
34        }
35        return socket;
36    }
37
38    public String[] getDefaultCipherSuites() {
39        return null;
40    }
41
42    public String[] getSupportedCipherSuites() {
43        return null;
44    }
45
46    /**
47     * @see javax.net.SocketFactory#createSocket(java.lang.String, int)
48     */
49    @Override
50    public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException {
51        // it is a fake
52        return null;
53    }
54
55    /**
56     * @see javax.net.SocketFactory#createSocket(java.net.InetAddress, int)
57     */
58    @Override
59    public Socket createSocket(InetAddress arg0, int arg1) throws IOException {
60        // it is a fake
61        return null;
62    }
63
64    /**
65     * @see javax.net.SocketFactory#createSocket(java.lang.String, int, java.net.InetAddress, int)
66     */
67    @Override
68    public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException {
69        // it is a fake
70        return null;
71    }
72
73    /**
74     * @see javax.net.SocketFactory#createSocket(java.net.InetAddress, int, java.net.InetAddress, int)
75     */
76    @Override
77    public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException {
78        // it is a fake
79        return null;
80    }
81}
82