Code example for TimeUnit

Methods: toNanos

0
                                   Timer timer,
                                   long timeoutSeconds) {
        super(); 
        this.channelHandler = channelHandler;
        this.timer = timer;
        this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);
 
    } 
     
    @Override 
    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
            throws Exception { 
        if (timeoutNanos > 0) {
            timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx), 
                                       timeoutNanos, TimeUnit.NANOSECONDS);
        } 
        ctx.sendUpstream(e);
    } 
     
    @Override 
    public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)