Skip to content

Commit

Permalink
Update for renames in amphp/websocket-server
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jun 5, 2022
1 parent f9562ae commit 0c8c939
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/WebsocketConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use Amp\TimeoutCancellation;
use Amp\Websocket\Client;
use Amp\Websocket\ClosedException;
use Amp\Websocket\Server\ClientHandler;
use Amp\Websocket\Server\EmptyHandshakeHandler;
use Amp\Websocket\Server\EmptyWebsocketHandshakeHandler;
use Amp\Websocket\Server\Websocket;
use Amp\Websocket\Server\WebsocketClientHandler;
use Amp\Websocket\WebsocketClient;
use Psr\Log\NullLogger;
use function Amp\async;
Expand All @@ -30,14 +30,14 @@ class WebsocketConnectionTest extends AsyncTestCase
* @return array{HttpServer, SocketAddress} Returns the HttpServer instance and the used port number.
* @throws SocketException
*/
protected function createServer(ClientHandler $clientHandler): array
protected function createServer(WebsocketClientHandler $clientHandler): array
{
$logger = new NullLogger;

$httpServer = new SocketHttpServer($logger);
$httpServer->expose(new InternetAddress('127.0.0.1', 0));
$httpServer->start(
new Websocket($logger, new EmptyHandshakeHandler(), $clientHandler),
new Websocket($logger, new EmptyWebsocketHandshakeHandler(), $clientHandler),
new DefaultErrorHandler(),
);

Expand All @@ -48,7 +48,7 @@ protected function createServer(ClientHandler $clientHandler): array

public function testSimpleBinaryEcho(): void
{
[$server, $address] = $this->createServer(new class implements ClientHandler {
[$server, $address] = $this->createServer(new class implements WebsocketClientHandler {
public function handleClient(WebsocketClient $client, Request $request, Response $response): void
{
while ($message = $client->receive()) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public function handleClient(WebsocketClient $client, Request $request, Response

public function testSimpleTextEcho(): void
{
[$server, $address] = $this->createServer(new class implements ClientHandler {
[$server, $address] = $this->createServer(new class implements WebsocketClientHandler {
public function handleClient(WebsocketClient $client, Request $request, Response $response): void
{
while ($message = $client->receive()) {
Expand Down Expand Up @@ -106,7 +106,7 @@ public function handleClient(WebsocketClient $client, Request $request, Response

public function testUnconsumedMessage(): void
{
[$server, $address] = $this->createServer(new class implements ClientHandler {
[$server, $address] = $this->createServer(new class implements WebsocketClientHandler {
public function handleClient(WebsocketClient $client, Request $request, Response $response): void
{
$client->send(\str_repeat('.', 1024 * 1024));
Expand Down Expand Up @@ -140,7 +140,7 @@ public function handleClient(WebsocketClient $client, Request $request, Response

public function testVeryLongMessage(): void
{
[$server, $address] = $this->createServer(new class implements ClientHandler {
[$server, $address] = $this->createServer(new class implements WebsocketClientHandler {
public function handleClient(WebsocketClient $client, Request $request, Response $response): void
{
$payload = \str_repeat('.', 1024 * 1024 * 10); // 10 MiB
Expand All @@ -164,7 +164,7 @@ public function handleClient(WebsocketClient $client, Request $request, Response

public function testTooLongMessage(): void
{
[$server, $address] = $this->createServer(new class() implements ClientHandler {
[$server, $address] = $this->createServer(new class implements WebsocketClientHandler {
public function handleClient(WebsocketClient $client, Request $request, Response $response): void
{
$payload = \str_repeat('.', 1024 * 1024 * 10 + 1); // 10 MiB + 1 byte
Expand Down

0 comments on commit 0c8c939

Please sign in to comment.