         assert(inEventLoop)
         
         do {
-            try (handler as! _ChannelInboundHandler).errorCaught(ctx: self, error: error)
+            try self.inboundHandler.errorCaught(ctx: self, error: error)
         } catch let err {
             // Forward the error thrown by errorCaught through the pipeline
             fireErrorCaught(error: err)

        assert(inEventLoop)
        
        do {
            try (handler as! _ChannelInboundHandler).userInboundEventTriggered(ctx: self, event: event)
        } catch let err {
            invokeErrorCaught(error: err)
        }

        assert(inEventLoop)
        
        do {
            try self.inboundHandler.channelInactive(ctx: self)
        } catch let err {
            invokeErrorCaught(error: err)
        }
