/** * creating a TCP socket fails because it is NOT a datagram socket */ public function testCreateClientFailTcp() { $promise = $this->factory->createClient('tcp://www.google.com:80'); $this->assertInstanceOf('React\\Promise\\PromiseInterface', $promise); $promise->then($this->expectCallableNever(), $this->expectCallableOnceParameter('Exception')); $this->loop->tick(); }
/** * Create a new RconConnection * * @param $host * @param $port * @param $password * * @return \gries\Rcon\Connection */ public static function create($host, $port, $password) { $factory = new \Socket\Raw\Factory(); $socket = $factory->createClient(sprintf('%s:%s', $host, $port)); return new \gries\Rcon\Connection($socket, $password); }