Code example for ServerSocket

Methods: setSoTimeout

0
    ServerSocket connector; 
     
    SimpleSmtpServer simpleSmtpServer; 
     
    public DumbsterWrapper() throws Exception { 
        connector = new ServerSocket(0); 
        connector.setSoTimeout(1500); 
        simpleSmtpServer = new SimpleSmtpServer(connector); 
    } 
     
    public void start() { 
        simpleSmtpServer.start(); 
        port = connector.getLocalPort(); 
    } 
     
    public void stop() { 
        simpleSmtpServer.stop(); 
    } 
     
    public int getPort() { 
        return port;