channel = new ChannelledStream( $this->read = new ResourceInputStream($read), $this->write = new ResourceOutputStream($write) ); } /** * {@inheritdoc} */ public function receive(): Promise { return $this->channel->receive(); } /** * {@inheritdoc} */ public function send($data): Promise { return $this->channel->send($data); } public function unreference(): void { $this->read->unreference(); } public function reference(): void { $this->read->reference(); } /** * Closes the read and write resource streams. */ public function close(): void { $this->read->close(); $this->write->close(); } }