Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Replace all occurrences of the search string with the replacement string
<?php str_replace(    array|string $search,    array|string $replace,    string|array $subject,    int &$count = null): string|array
<?php         $encryption = $this->streamEncryption;

        $connected = false;

        $promise = $this->connector->connect(

            \str_replace('tls://', '', $uri)

        )->then(function (ConnectionInterface $connection) use ($context, $encryption, $uri, &$promise, &$connected) {


            $connected = true;
<?php             return null;

        }



        return \str_replace('tcp://' , 'tls://', $address);

    }



    public function pause()
<?php         if ($scheme === 'unix') {

            $server = new UnixServer($uri, $loop, $context['unix']);

        } else {

            $server = new TcpServer(str_replace('tls://', '', $uri), $loop, $context['tcp']);



            if ($scheme === 'tls') {

                $server = new SecureServer($server, $loop, $context['tls']);
<?php                 );

            }



            $server = new TcpServer(str_replace('tls://', '', $uri), $loop, $context['tcp']);



            if ($scheme === 'tls') {

                $server = new SecureServer($server, $loop, $context['tls']);
<?php     {

        $error = null;

        \set_error_handler(function ($_, $errstr) use (&$error) {

            $error = \str_replace(array("\r", "\n"), ' ', $errstr);




            if (($pos = \strpos($error, "): ")) !== false) {
<?php         }



        $server = new TcpServer(0);

        $uri = str_replace('tcp://', 'tls://', $server->getAddress());



        $connector = new Connector(array());

        $promise = $connector->connect($uri);
<?php         $errorEvent = $this->createPromiseForServerError($server);



        $connector = new TcpConnector();

        $promise = $connector->connect(str_replace('tls://', '', $server->getAddress()));



        $promise->then(function (ConnectionInterface $stream) {

            $stream->close();
<?php         $errorEvent = $this->createPromiseForServerError($server);



        $connector = new TcpConnector();

        $promise = $connector->connect(str_replace('tls://', '', $server->getAddress()));



        $promise->then(function (ConnectionInterface $stream) {

            $stream->end("\x1e");
<?php         $server->on('error', $this->expectCallableNever());



        $connector = new TcpConnector();

        $promise = $connector->connect(str_replace('tls://', '', $server->getAddress()));



        $connection = Block\await($promise, null, self::TIMEOUT);

        $this->assertInstanceOf('React\Socket\ConnectionInterface', $connection);
<?php         $errorEvent = $this->createPromiseForServerError($server);



        $connector = new TcpConnector();

        $promise = $connector->connect(str_replace('tls://', '', $server->getAddress()));



        $promise->then(function (ConnectionInterface $stream) {

            $stream->write("GET / HTTP/1.0\r\n\r\n");
<?php         $errorEvent = $this->createPromiseForServerError($server);



        $connector = new TcpConnector();

        $promise = $connector->connect(str_replace('tls://', '', $server->getAddress()));



        $promise->then(function (ConnectionInterface $stream) {

            $stream->write("Hello world!\n");
<?php         ));

        $server->on('connection', $this->expectCallableNever());



        $client = stream_socket_client(str_replace('tls://', '', $server->getAddress()));



        Block\sleep(0.1, null);
<?php         ));

        $socket->on('connection', $this->expectCallableNever());



        $client = stream_socket_client(str_replace('tls://', '', $socket->getAddress()));



        Block\sleep(0.1);