public function testUnsubscribe()
 {
     $this->testSubject->subscribe('commandOne');
     $this->testSubject->subscribe('commandTwo');
     $anotherNode = new RedisTemplate('tcp://127.0.0.1:6379?read_write_timeout=-1', 'test-node2', []);
     $anotherNode->subscribe('commandTwo');
     $this->testSubject->unsubscribe('commandOne');
     $this->testSubject->unsubscribe('commandTwo');
     $this->assertEmpty($this->testSubject->getSubscriptions('commandOne'));
     $secondMembers = $this->testSubject->getSubscriptions('commandTwo');
     $this->assertCount(1, $secondMembers);
     $this->assertContains('test-node2', $secondMembers);
 }
 public function testRemoteDispatchReplyTimeout()
 {
     $this->localSegment->subscribe(TestCommand::class, new TestCommandHandler());
     $remoteTemplate = new RedisTemplate('tcp://127.0.0.1:6379?read_write_timeout=-1', 'test-node2', []);
     $remoteTemplate->subscribe(TestCommand::class);
     $this->template->setTimeout(1);
     $interceptor = new DispatchInterceptor();
     $this->localSegment->setDispatchInterceptors([$interceptor]);
     $callback = new ClosureCommandCallback(function ($result) {
         $this->fail('Exception expected');
     }, function ($error) {
         $this->assertInstanceOf(CommandTimeoutException::class, $error);
     });
     $this->testSubject->send('key', GenericCommandMessage::asCommandMessage(new TestCommand('key')), $callback);
     $this->assertEmpty($interceptor->commands);
     $this->assertEmpty($this->template->getClient()->keys('governor:response:*'));
     $this->assertCount(1, $this->template->getPendingCommands($remoteTemplate->getNodeName()));
 }
 /**
  *
  */
 public function saveSubscriptions()
 {
     foreach ($this->localSegment->getSubscriptions() as $command => $handler) {
         $this->template->subscribe($command);
     }
 }