public static function create($context, $type, LoggerInterface $logger = null, $persistentId = null, $onNewSocket = null)
    {
        if (!is_callable($onNewSocket)) {
            $onNewSocket = null;
        }

        $newSocket = false;
        $callback = function() use ($onNewSocket, &$newSocket) {
            $newSocket = true;
            if ($onNewSocket !== null) {
                $onNewSocket();
            }
        };

        $instance = new self($context, $type, $persistentId, $callback);
        $instance->setId(self::$nextId);
        $instance->setNewSocket($newSocket);
        $instance->setSockOpt(ZMQ::SOCKOPT_LINGER, 0);
        self::$nextId++;

        if (null !== $logger) {
            $instance->setLogger($logger);
        }

        return $instance;
    }