77use React \Socket \SecureServer ;
88use React \Socket \TcpConnector ;
99use React \Socket \SecureConnector ;
10- use React \Stream \Stream ;
1110use Clue \React \Block ;
1211use React \Promise \Promise ;
1312use Evenement \EventEmitterInterface ;
1413use React \Promise \Deferred ;
1514use React \Stream \BufferedSink ;
15+ use React \Socket \ConnectionInterface ;
1616
1717class SecureIntegrationTest extends TestCase
1818{
@@ -49,7 +49,7 @@ public function tearDown()
4949 public function testConnectToServer ()
5050 {
5151 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
52- /* @var $client Stream */
52+ /* @var $client ConnectionInterface */
5353
5454 $ client ->close ();
5555 }
@@ -61,7 +61,7 @@ public function testConnectToServerEmitsConnection()
6161 $ promiseClient = $ this ->connector ->connect ($ this ->address );
6262
6363 list ($ _ , $ client ) = Block \awaitAll (array ($ promiseServer , $ promiseClient ), $ this ->loop , self ::TIMEOUT );
64- /* @var $client Stream */
64+ /* @var $client ConnectionInterface */
6565
6666 $ client ->close ();
6767 }
@@ -70,14 +70,14 @@ public function testSendSmallDataToServerReceivesOneChunk()
7070 {
7171 // server expects one connection which emits one data event
7272 $ received = new Deferred ();
73- $ this ->server ->on ('connection ' , function (Stream $ peer ) use ($ received ) {
73+ $ this ->server ->on ('connection ' , function (ConnectionInterface $ peer ) use ($ received ) {
7474 $ peer ->on ('data ' , function ($ chunk ) use ($ received ) {
7575 $ received ->resolve ($ chunk );
7676 });
7777 });
7878
7979 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
80- /* @var $client Stream */
80+ /* @var $client ConnectionInterface */
8181
8282 $ client ->write ('hello ' );
8383
@@ -92,7 +92,7 @@ public function testSendSmallDataToServerReceivesOneChunk()
9292 public function testSendDataWithEndToServerReceivesAllData ()
9393 {
9494 $ disconnected = new Deferred ();
95- $ this ->server ->on ('connection ' , function (Stream $ peer ) use ($ disconnected ) {
95+ $ this ->server ->on ('connection ' , function (ConnectionInterface $ peer ) use ($ disconnected ) {
9696 $ received = '' ;
9797 $ peer ->on ('data ' , function ($ chunk ) use (&$ received ) {
9898 $ received .= $ chunk ;
@@ -103,7 +103,7 @@ public function testSendDataWithEndToServerReceivesAllData()
103103 });
104104
105105 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
106- /* @var $client Stream */
106+ /* @var $client ConnectionInterface */
107107
108108 $ data = str_repeat ('a ' , 200000 );
109109 $ client ->end ($ data );
@@ -117,14 +117,14 @@ public function testSendDataWithEndToServerReceivesAllData()
117117 public function testSendDataWithoutEndingToServerReceivesAllData ()
118118 {
119119 $ received = '' ;
120- $ this ->server ->on ('connection ' , function (Stream $ peer ) use (&$ received ) {
120+ $ this ->server ->on ('connection ' , function (ConnectionInterface $ peer ) use (&$ received ) {
121121 $ peer ->on ('data ' , function ($ chunk ) use (&$ received ) {
122122 $ received .= $ chunk ;
123123 });
124124 });
125125
126126 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
127- /* @var $client Stream */
127+ /* @var $client ConnectionInterface */
128128
129129 $ data = str_repeat ('d ' , 200000 );
130130 $ client ->write ($ data );
@@ -139,12 +139,12 @@ public function testSendDataWithoutEndingToServerReceivesAllData()
139139
140140 public function testConnectToServerWhichSendsSmallDataReceivesOneChunk ()
141141 {
142- $ this ->server ->on ('connection ' , function (Stream $ peer ) {
142+ $ this ->server ->on ('connection ' , function (ConnectionInterface $ peer ) {
143143 $ peer ->write ('hello ' );
144144 });
145145
146146 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
147- /* @var $client Stream */
147+ /* @var $client ConnectionInterface */
148148
149149 // await client to report one "data" event
150150 $ receive = $ this ->createPromiseForEvent ($ client , 'data ' , $ this ->expectCallableOnceWith ('hello ' ));
@@ -156,12 +156,12 @@ public function testConnectToServerWhichSendsSmallDataReceivesOneChunk()
156156 public function testConnectToServerWhichSendsDataWithEndReceivesAllData ()
157157 {
158158 $ data = str_repeat ('b ' , 100000 );
159- $ this ->server ->on ('connection ' , function (Stream $ peer ) use ($ data ) {
159+ $ this ->server ->on ('connection ' , function (ConnectionInterface $ peer ) use ($ data ) {
160160 $ peer ->end ($ data );
161161 });
162162
163163 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
164- /* @var $client Stream */
164+ /* @var $client ConnectionInterface */
165165
166166 // await data from client until it closes
167167 $ received = Block \await (BufferedSink::createPromise ($ client ), $ this ->loop , self ::TIMEOUT );
@@ -172,12 +172,12 @@ public function testConnectToServerWhichSendsDataWithEndReceivesAllData()
172172 public function testConnectToServerWhichSendsDataWithoutEndingReceivesAllData ()
173173 {
174174 $ data = str_repeat ('c ' , 100000 );
175- $ this ->server ->on ('connection ' , function (Stream $ peer ) use ($ data ) {
175+ $ this ->server ->on ('connection ' , function (ConnectionInterface $ peer ) use ($ data ) {
176176 $ peer ->write ($ data );
177177 });
178178
179179 $ client = Block \await ($ this ->connector ->connect ($ this ->address ), $ this ->loop , self ::TIMEOUT );
180- /* @var $client Stream */
180+ /* @var $client ConnectionInterface */
181181
182182 // buffer incoming data for 0.1s (should be plenty of time)
183183 $ received = '' ;
0 commit comments