Skip to content

Commit 6ade264

Browse files
committed
Added Http2Client::isConnected().
1 parent 7703c9e commit 6ade264

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Http/V2/Client.php

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public function close(): bool
5959
return $this->client->close();
6060
}
6161

62+
public function isConnected(): bool
63+
{
64+
return $this->client->connected;
65+
}
66+
6267
private function transformResponse(SwResponse $request): ResponseInterface
6368
{
6469
return new Response(

tests/Cases/Http2ClientTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ public function testHttp2ServerReceived()
3939
$client->send(new Request('/not-found'));
4040
$response = $client->recv(1);
4141
$this->assertSame(404, $response->getStatusCode());
42+
43+
$this->assertTrue($client->isConnected());
44+
45+
$client->close();
46+
47+
$this->assertFalse($client->isConnected());
4248
});
4349
}
4450
}

0 commit comments

Comments
 (0)