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);
 }
 private function findSuitableNode(CommandMessageInterface $command)
 {
     $nodes = $this->template->getSubscriptions($command->getCommandName());
     if (empty($nodes)) {
         throw new NoHandlerForCommandException(sprintf("No handler in cluster was subscribed for command [%s]", $command->getCommandName()));
     }
     return $nodes[0];
     // TODO temporary something more elaborate :)
 }