Пример #1
0
 public function initialize()
 {
     $sockets = [];
     $response = $this->getSocketLib()->createPair($this->getDomain(), $this->getType(), $this->getProtocol(), $sockets);
     if (false($response)) {
         throw new SocketPairException($this->getSocketLib()->stringError($this->getSocketLib()->lastError()));
     }
     $this->left = new Socket();
     $this->left->setSocket(reset($sockets));
     $this->right = new Socket();
     $this->right->setSocket(end($sockets));
 }
Пример #2
0
 /**
  * @expectedException \Thruster\Components\Socket\Exception\SocketException
  * @expectedExceptionMessage read: foo_bar
  */
 public function testReadFail()
 {
     $this->socketLib->expects($this->once())->method('read')->willReturn(false);
     $this->socketLib->expects($this->once())->method('stringError')->willReturn('foo_bar');
     $this->socket->read(10);
 }
Пример #3
0
 public function __construct($method, Socket $socket)
 {
     $message = sprintf('%s: %s', $method, $socket->getLastErrorMessage());
     parent::__construct($message);
 }