From 074b70d1fdba6c3c270b411e0290ed7c48edf53c Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Tue, 31 Dec 2019 18:02:00 +0100 Subject: [PATCH] Fix UnlimitedConnectionPool construction --- examples/http-client-via-proxy.php | 5 ++--- test/Http1TunnelConnectorTest.php | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/http-client-via-proxy.php b/examples/http-client-via-proxy.php index 446cfb3..25ec205 100644 --- a/examples/http-client-via-proxy.php +++ b/examples/http-client-via-proxy.php @@ -1,5 +1,6 @@ usingPool(new UnlimitedConnectionPool($connector)) + ->usingPool(new UnlimitedConnectionPool(new DefaultConnectionFactory($connector))) ->build(); $request = new Request('http://amphp.org/'); @@ -41,7 +42,6 @@ \implode('+', $request->getProtocolVersions()) ); - /** @noinspection PhpUnhandledExceptionInspection */ print Rfc7230::formatHeaders($request->getHeaders()) . "\r\n\r\n"; \printf( @@ -51,7 +51,6 @@ $response->getReason() ); - /** @noinspection PhpUnhandledExceptionInspection */ print Rfc7230::formatHeaders($response->getHeaders()) . "\r\n\r\n"; $body = yield $response->getBody()->buffer(); diff --git a/test/Http1TunnelConnectorTest.php b/test/Http1TunnelConnectorTest.php index f9b45f4..9ef90c5 100644 --- a/test/Http1TunnelConnectorTest.php +++ b/test/Http1TunnelConnectorTest.php @@ -2,6 +2,7 @@ namespace Amp\Http\Tunnel; +use Amp\Http\Client\Connection\DefaultConnectionFactory; use Amp\Http\Client\Connection\UnlimitedConnectionPool; use Amp\Http\Client\HttpClientBuilder; use Amp\Http\Client\Request; @@ -22,7 +23,7 @@ public function test(): \Generator $connector = new Http1TunnelConnector(SocketAddress::fromSocketName($address)); $client = (new HttpClientBuilder) - ->usingPool(new UnlimitedConnectionPool($connector)) + ->usingPool(new UnlimitedConnectionPool(new DefaultConnectionFactory($connector))) ->build(); $request = new Request('https://httpbin.org/headers');