protected function sendAndReceive($request, stdClass $context)
{
$future = new Future();
if ($this->fullDuplex) {
if ($this->fdtrans === null || $this->fdtrans->uri !== $this->uri) {
$this->fdtrans = new FullDuplexTransporter($this);
}
$this->fdtrans->sendAndReceive($request, $future, $context);
} else {
if ($this->hdtrans === null || $this->hdtrans->uri !== $this->uri) {
$this->hdtrans = new HalfDuplexTransporter($this);
}
$this->hdtrans->sendAndReceive($request, $future, $context);
}
if ($context->oneway) {
$future->resolve(null);
}
return $future;
}