diff --git a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java index 69ffc49b17..803d54a17a 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java @@ -101,13 +101,13 @@ public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler if (unit == null) { throw new NullPointerException("unit"); } - if (timeout <= 0) { - throw new IllegalArgumentException( - "timeout: " + timeout + " (expected: a positive integer)"); - } this.timer = timer; - timeoutMillis = Math.max(unit.toMillis(timeout), 1); + if (timeout <= 0) { + timeoutMillis = 0; + } else { + timeoutMillis = Math.max(unit.toMillis(timeout), 1); + } } /** diff --git a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java index 3da2ddd0e1..56b4cf5c75 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java @@ -97,13 +97,13 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler if (unit == null) { throw new NullPointerException("unit"); } - if (timeout <= 0) { - throw new IllegalArgumentException( - "timeout: " + timeout + " (expected: a positive integer)"); - } this.timer = timer; - timeoutMillis = Math.max(unit.toMillis(timeout), 1); + if (timeout <= 0) { + timeoutMillis = 0; + } else { + timeoutMillis = Math.max(unit.toMillis(timeout), 1); + } } /**