01: /*
02: * Wrapper around the JSSE Netlet package. This is the only class in the applet that
03: * has direct reference to com.sun.portal.netlet.crypt.jsse stuff. Just trying to bridge
04: * with the Abstact Factory and break the rest of the dependency on netlet jsse stuff
05: *
06: * @author Rajesh T
07: * @ date 16-July-2003
08: *
09: */
10: package com.sun.portal.netlet.client.common;
11:
12: import com.sun.portal.netlet.crypt.jsse.NetletJSSEWrapper;
13: import java.net.Socket;
14:
15: public class JSSEWrapper implements NetletSocketWrapper {
16: private NetletJSSEWrapper njssew = new NetletJSSEWrapper();
17:
18: /*
19: * Creates a instance os JSSE Wrapper Factory. Delegates all the responsibility
20: * to the underlying instance.
21: */
22:
23: public JSSEWrapper() {
24: }
25:
26: /*
27: *
28: */
29:
30: public void init(boolean requireClientCert) {
31: try {
32: njssew.init(requireClientCert);
33: } catch (Exception e) {
34: e.printStackTrace();
35: }
36: }
37:
38: /*
39: */
40:
41: public Socket getSocket(String destHost, int destPort,
42: String[] cipherSuites) {
43: try {
44: return njssew.connect(destHost, destPort, cipherSuites);
45: } catch (Exception e) {
46: e.printStackTrace();
47: }
48: return null;
49: }
50:
51: /*
52: */
53:
54: public Socket getSocket(Socket tunnelSocket, String host, int port,
55: String[] cipherSuites) {
56: try {
57: return njssew.connect(tunnelSocket, host, port,
58: cipherSuites);
59: } catch (Exception e) {
60: e.printStackTrace();
61: }
62: return null;
63: }
64:
65: /*
66: */
67:
68: public void cleanup() {
69: njssew.cleanup();
70: }
71: }
|