FileDocCategorySizeDatePackage
MultiServerSocketFactory.javaAPI DocExample2627Wed Apr 19 11:20:16 BST 2000examples.rmisocfac

MultiServerSocketFactory

public class MultiServerSocketFactory extends Object implements Serializable, RMIServerSocketFactory

Fields Summary
private static RMISocketFactory
defaultFactory
private String
protocol
private byte[]
data
Constructors Summary
public MultiServerSocketFactory(String protocol, byte[] data)


          
	this.protocol = protocol;
	this.data = data;
    
Methods Summary
public java.net.ServerSocketcreateServerSocket(int port)

	if (protocol.equals("compression")) {
            System.out.println("using compression sockets");
	    return new CompressionServerSocket(port);
	    
	} else if (protocol.equals("xor")) {
            System.out.println("using xor sockets");
	    if (data == null || data.length != 1)
		throw new IOException("invalid argument for XOR protocol");
	    return new XorServerSocket(port, data[0]);
	} 
        System.out.println("using default socket protocol");	
	return defaultFactory.createServerSocket(port);