コード例 #1
0
 /**
  * @depends testServerNonBlocking
  */
 public function testServerNonBlockingAcceptClient(Socket $server)
 {
     // create local client connected to the given server
     $client = $this->factory->createClient($server->getSockName());
     // client connected, so we can not accept() this socket
     $peer = $server->accept();
     // peer should be writable right away
     $this->assertTrue($peer->selectWrite(0.1));
     $peer->write('test');
     // expect to receive the message in one chunk
     $this->assertEquals('test', $client->read(100));
     // disconnect local client
     $client->close();
     // disconnection should be detected withing 1s max
     $this->assertTrue($peer->selectRead(1.0));
     $peer->close();
 }
コード例 #2
0
ファイル: FactoryTest.php プロジェクト: shsrain/ypyzApi
 /**
  * @depends testSupportsIpv6
  */
 public function testCreateClientUdp6UnboundWorks()
 {
     $socket = $this->factory->createClient('udp://[::1]:3');
     $this->assertInstanceOf('Socket\\Raw\\Socket', $socket);
 }