/** * @runInSeparateProcess * @expectedException Riak\Client\Core\Transport\RiakTransportException * @expectedExceptionMessage Fail to connect to : tcp://riak.local:8087 [ ] */ public function testCreateConnectionException() { $mocks = $this->createMockFunctions(); $mocks['stream_socket_client']->expects($this->once())->with($this->equalTo('tcp://riak.local:8087'))->willReturn(null); $mocks['is_resource']->expects($this->once())->willReturn(false); $this->instance->createStream(); }
/** * Send a Protobuf message using a new stream and return it for future usage * * @param \DrSlump\Protobuf\Message $message * @param integer $messageCode * * @return \Riak\Client\Core\Transport\Proto\ProtoStream */ public function emit(Message $message, $messageCode) { $payload = $this->encodeMessage($message, $messageCode); $stream = $this->connection->createStream(); return $this->connection->send($payload, $stream); }