I am using jsse1.0.2, Redhat 6.2 jdk 1.2.2. Thanks, -Raj
Hi,
I am trying to implement my version of RMISocketFactory that provides ssl sockets instead of regular sockets. I extended RMISocketFactory as follows but compiler complains that i can not extend it's methods!package bank;
import java.io.*;
import java.rmi.server.*;
import javax.net.*;
import javax.net.ssl.*;public class CGGAMPSSLSocketFactory extends RMISocketFactory {
public Socket createSocket(String host,int port) throws IOException{
SSLSocket socket = (SSLSocket)SSLSocketFactory.getDefault().
createSocket(host,port);
String ciphers[] = socket.getEnabledCipherSuites();
socket.setEnabledCipherSuites(ciphers);
return socket;
}public ServerSocket createServerSocket(int port) throws IOException {
SSLServerSocket server = (SSLServerSocket)
SSLServerSocketFactory.getDefault().createServerSocket(port);
String ciphers[] = server.getEnabledCipherSuites();
server.setEnabledCipherSuites(ciphers);
return server;
}
}
Here is the compiler complain,
black:rpatel% javac bank/CGGAMPSSLSocketFactory.java
bank/CGGAMPSSLSocketFactory.java:17: The method bank.Socket createSocket(java.lang.String, int) declared in class bank.CGGAMPSSLSocketFactory cannot override the method of the same signature declared in class java.rmi.server.RMISocketFactory. They must have the same return type.
public Socket createSocket(String host,int port) throws IOException{
^
bank/CGGAMPSSLSocketFactory.java:25: The method bank.ServerSocket createServerSocket(int) declared in class bank.CGGAMPSSLSocketFactory cannot override the method of the same signature declared in class java.rmi.server.RMISocketFactory. They must have the same return type.
public ServerSocket createServerSocket(int port) throws IOException {
^
2 errors
black:rpatel%I am totally lost i have the same function signature as of RMISocketFactory. Why the compiler does not like it? I would appreciate your quick response,
Thanks,
-Raj