Code example for ServerSocket

Methods: close, setSoTimeout

0
            ChannelSink sink) {
 
        super(factory, pipeline, sink);
 
        try { 
            socket = new ServerSocket();
        } catch (IOException e) {
            throw new ChannelException( 
                    "Failed to open a server socket.", e);
        } 
 
        try { 
            socket.setSoTimeout(1000);
        } catch (IOException e) {
            try { 
                socket.close();
            } catch (IOException e2) {
                logger.warn(
                        "Failed to close a partially initialized socket.", e2);
            } 
            throw new ChannelException( 
                    "Failed to set the server socket timeout.", e);
        } 
 
        config = new DefaultServerSocketChannelConfig(socket);
 
        fireChannelOpen(this);
    } 
 
    public ServerSocketChannelConfig getConfig() {