private static function build(
        $host,
        $port,
        $user,
        $pass,
        $exchangeName,
        $sync,
        $escapeMode,
        $timeout
    ) {
        $driver = DriverFactory::getDriver([
            'host' => $host,
            'port' => $port,
            'user' => $user,
            'pwd'  => $pass
        ]);

        $publisher = ($sync) ?
            new SyncPublisher($driver, $exchangeName, $timeout):
            new AsyncPublisher($driver, $exchangeName);

        if ($escapeMode === self::ESCAPE_MODE_NONE) {
            return $publisher;
        }

        if ($escapeMode === self::ESCAPE_MODE_JSON) {
            return new SerializingPublisher($publisher, new JsonSerializer());
        }

        if ($escapeMode === self::ESCAPE_MODE_SERIALIZE) {
            return new SerializingPublisher($publisher, new PhpSerializer());
        }

        throw new \InvalidArgumentException('Bad serializer name');
    }