KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rmijdbc > RJSSLClientSocketFactory


1 /*
2  * RMISSLClientSocketFactory.java
3  *
4  * Created on October 7, 2001, 6:18 PM
5  * @Author Douglas Hammond(djhammond@sympatico.ca)
6  */

7
8 package org.objectweb.rmijdbc;
9
10 import java.net.*;
11 import java.io.*;
12 import javax.net.ssl.*;
13 //import com.sun.net.ssl.*;
14
import java.rmi.server.*;
15
16 /**
17  * SocketFactory with SSL support
18  */

19 public class RJSSLClientSocketFactory implements RMIClientSocketFactory, Serializable {
20     public Socket createSocket(String JavaDoc host, int port)
21         throws IOException {
22             SSLSocketFactory factory =
23                 (SSLSocketFactory) SSLSocketFactory.getDefault();
24     
25             SSLSocket sslSocket = null;
26             try {
27                 sslSocket =
28                 (SSLSocket) factory.createSocket(host, port);
29                 
30 // String [] cipherSuites = sslSocket.getEnabledCipherSuites();
31

32 // for (int i = 0; i < cipherSuites.length; i++) {
33
// System.out.println("Cipher Suite " + i +
34
// " = " + cipherSuites[i]);
35
// }
36
} catch(IOException e) {
37                 e.printStackTrace();
38                 System.exit(2);
39             }
40             return sslSocket;
41     }
42 }
43
Popular Tags