@@ -7,7 +7,7 @@ Async HTTP CONNECT proxy connector, use any TCP/IP protocol through an HTTP prox
77* [ Quickstart example] ( #quickstart-example )
88* [ Usage] ( #usage )
99 * [ ConnectorInterface] ( #connectorinterface )
10- * [ create ()] ( #create )
10+ * [ connect ()] ( #connect )
1111 * [ ProxyConnector] ( #proxyconnector )
1212* [ Install] ( #install )
1313* [ Tests] ( #tests )
@@ -25,7 +25,7 @@ $connector = new TcpConnector($loop);
2525$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
2626$ssl = new SecureConnector($proxy, $loop);
2727
28- $ssl->create ('google.com', 443)->then(function (Stream $stream) {
28+ $ssl->connect ('google.com: 443' )->then(function (ConnectionInterface $stream) {
2929 $stream->write("GET / HTTP/1.1\r\nHost: google.com\r\nConnection: close\r\n\r\n");
3030 $stream->on('data', function ($chunk) {
3131 echo $chunk;
@@ -59,17 +59,17 @@ HTTP CONNECT proxy.
5959
6060The interface only offers a single method:
6161
62- #### create ()
62+ #### connect ()
6363
64- The ` create (string $host, int $port ): PromiseInterface<Stream , Exception>` method
64+ The ` connect (string $uri ): PromiseInterface<ConnectionInterface , Exception>` method
6565can be used to establish a streaming connection.
6666It returns a [ Promise] ( https://github.com/reactphp/promise ) which either
67- fulfills with a [ Stream ] ( https://github.com/reactphp/stream ) or
67+ fulfills with a [ ConnectionInterface ] ( https://github.com/reactphp/socket-client#connectioninterface ) or
6868rejects with an ` Exception ` :
6969
7070``` php
71- $connector->create ('google.com', 443)->then(
72- function (Stream $stream) {
71+ $connector->connect ('google.com: 443' )->then(
72+ function (ConnectionInterface $stream) {
7373 // connection successfully established
7474 },
7575 function (Exception $error) {
@@ -121,7 +121,7 @@ connector is actually inherently a general-purpose plain TCP/IP connector:
121121``` php
122122$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
123123
124- $proxy->create ('smtp.googlemail.com', 587)->then(function (Stream $stream) {
124+ $proxy->connect ('smtp.googlemail.com: 587' )->then(function (ConnectionInterface $stream) {
125125 $stream->write("EHLO local\r\n");
126126 $stream->on('data', function ($chunk) use ($stream) {
127127 echo $chunk;
@@ -141,7 +141,7 @@ instance:
141141$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
142142$ssl = new SecureConnector($proxy, $loop);
143143
144- $ssl->create ('smtp.googlemail.com', 465)->then(function (Stream $stream) {
144+ $ssl->connect ('smtp.googlemail.com: 465' )->then(function (ConnectionInterface $stream) {
145145 $stream->write("EHLO local\r\n");
146146 $stream->on('data', function ($chunk) use ($stream) {
147147 echo $chunk;
@@ -163,7 +163,7 @@ instance to create a secure connection to the proxy:
163163$ssl = new SecureConnector($connector, $loop);
164164$proxy = new ProxyConnector('127.0.0.1:443', $ssl);
165165
166- $proxy->create ('smtp.googlemail.com', 587);
166+ $proxy->connect ('smtp.googlemail.com: 587' );
167167```
168168
169169## Install
0 commit comments