The path to connect to is set once during instantiation, the actual target host is then ignored. Unix domain sockets use atomic operations, so we can as well emulate async behavior.
Inheritance: implements React\SocketClient\ConnectorInterface
Example #1
0
 public function testValid()
 {
     $path = tempnam(sys_get_temp_dir(), 'socket');
     $server = @stream_socket_server('unix://' . $path, $errno, $errstr);
     if (!$server) {
         $this->markTestSkipped('Unable to create socket: ' . $errstr . '(' . $errno . ')');
         return;
     }
     $loop = $this->getMock('React\\EventLoop\\LoopInterface');
     $connector = new UnixConnector($loop, 'unix://' . $path);
     $promise = $connector->create('localhost', 80);
     $stream = Block\await($promise, $loop);
     /* @var $stream React\Stream\Stream */
     $stream->close();
     fclose($server);
     unlink($path);
 }