Skip to content

Commit

Permalink
Fix UnlimitedConnectionPool construction
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Dec 31, 2019
1 parent ade977a commit 074b70d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions examples/http-client-via-proxy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Amp\Http\Client\Connection\DefaultConnectionFactory;
use Amp\Http\Client\Connection\UnlimitedConnectionPool;
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\HttpException;
Expand All @@ -24,7 +25,7 @@
$connector = new Http1TunnelConnector(new SocketAddress('127.0.0.1', 5512));

$client = (new HttpClientBuilder)
->usingPool(new UnlimitedConnectionPool($connector))
->usingPool(new UnlimitedConnectionPool(new DefaultConnectionFactory($connector)))
->build();

$request = new Request('http://amphp.org/');
Expand All @@ -41,7 +42,6 @@
\implode('+', $request->getProtocolVersions())
);

/** @noinspection PhpUnhandledExceptionInspection */
print Rfc7230::formatHeaders($request->getHeaders()) . "\r\n\r\n";

\printf(
Expand All @@ -51,7 +51,6 @@
$response->getReason()
);

/** @noinspection PhpUnhandledExceptionInspection */
print Rfc7230::formatHeaders($response->getHeaders()) . "\r\n\r\n";

$body = yield $response->getBody()->buffer();
Expand Down
3 changes: 2 additions & 1 deletion test/Http1TunnelConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down

0 comments on commit 074b70d

Please sign in to comment.