private function createStreamListener()
    {
        $callback = function ($event, $status, $events, $stream) {
            if (!isset($this->streamEvents[(int) $stream])) {
                return;
            }

            if (($events | 4) === 4) {
                // Disconnected
                return;
            }

            if (isset($this->readStreams[(int) $stream]) && ($events & \UV::READABLE)) {
                \call_user_func($this->readStreams[(int) $stream], $stream);
            }

            if (isset($this->writeStreams[(int) $stream]) && ($events & \UV::WRITABLE)) {
                \call_user_func($this->writeStreams[(int) $stream], $stream);
            }
        };

        return $callback;
    }