9
9
use React \Socket \SecureServer ;
10
10
use React \Socket \TcpConnector ;
11
11
use React \Socket \TcpServer ;
12
- // use function Clue\ React\Block \await;
12
+ // use function React\Async \await;
13
13
// use function React\Promise\all;
14
14
// use function React\Promise\Timer\timeout;
15
15
@@ -40,7 +40,7 @@ public function testClientCanConnectToServer()
40
40
$ promise = $ connector ->connect ($ server ->getAddress ());
41
41
42
42
/* @var ConnectionInterface $client */
43
- $ client = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
43
+ $ client = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
44
44
45
45
$ this ->assertInstanceOf ('React\Socket\ConnectionInterface ' , $ client );
46
46
$ this ->assertEquals ($ server ->getAddress (), $ client ->getRemoteAddress ());
@@ -69,7 +69,7 @@ public function testClientUsesTls13ByDefaultWhenSupportedByOpenSSL()
69
69
$ promise = $ connector ->connect ($ server ->getAddress ());
70
70
71
71
/* @var ConnectionInterface $client */
72
- $ client = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
72
+ $ client = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
73
73
74
74
$ this ->assertInstanceOf ('React\Socket\Connection ' , $ client );
75
75
$ this ->assertTrue (isset ($ client ->stream ));
@@ -108,7 +108,7 @@ public function testClientUsesTls12WhenCryptoMethodIsExplicitlyConfiguredByClien
108
108
$ promise = $ connector ->connect ($ server ->getAddress ());
109
109
110
110
/* @var ConnectionInterface $client */
111
- $ client = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
111
+ $ client = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
112
112
113
113
$ this ->assertInstanceOf ('React\Socket\Connection ' , $ client );
114
114
$ this ->assertTrue (isset ($ client ->stream ));
@@ -139,7 +139,7 @@ public function testClientUsesTls12WhenCryptoMethodIsExplicitlyConfiguredByServe
139
139
$ promise = $ connector ->connect ($ server ->getAddress ());
140
140
141
141
/* @var ConnectionInterface $client */
142
- $ client = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
142
+ $ client = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
143
143
144
144
$ this ->assertInstanceOf ('React\Socket\Connection ' , $ client );
145
145
$ this ->assertTrue (isset ($ client ->stream ));
@@ -171,7 +171,7 @@ public function testClientUsesTls10WhenCryptoMethodIsExplicitlyConfiguredByClien
171
171
172
172
/* @var ConnectionInterface $client */
173
173
try {
174
- $ client = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
174
+ $ client = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
175
175
} catch (\RuntimeException $ e ) {
176
176
// legacy TLS 1.0 would be considered insecure by today's standards, so skip test if connection fails
177
177
// OpenSSL error messages are version/platform specific
@@ -213,7 +213,7 @@ public function testServerEmitsConnectionForClientConnection()
213
213
214
214
// await both client and server side end of connection
215
215
/* @var ConnectionInterface[] $both */
216
- $ both = \Clue \ React \Block \await (\React \Promise \Timer \timeout (\React \Promise \all (array ($ peer , $ client )), self ::TIMEOUT ));
216
+ $ both = \React \Async \await (\React \Promise \Timer \timeout (\React \Promise \all (array ($ peer , $ client )), self ::TIMEOUT ));
217
217
218
218
// both ends of the connection are represented by different instances of ConnectionInterface
219
219
$ this ->assertCount (2 , $ both );
@@ -253,7 +253,7 @@ public function testClientEmitsDataEventOnceForDataWrittenFromServer()
253
253
}, $ reject );
254
254
});
255
255
256
- $ data = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
256
+ $ data = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
257
257
258
258
$ this ->assertEquals ('foo ' , $ data );
259
259
@@ -294,7 +294,7 @@ public function testWritesDataInMultipleChunksToConnection()
294
294
}, $ reject );
295
295
});
296
296
297
- $ received = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
297
+ $ received = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
298
298
299
299
$ this ->assertEquals (400000 , $ received );
300
300
@@ -335,7 +335,7 @@ public function testWritesMoreDataInMultipleChunksToConnection()
335
335
}, $ reject );
336
336
});
337
337
338
- $ received = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
338
+ $ received = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
339
339
340
340
$ this ->assertEquals (2000000 , $ received );
341
341
@@ -368,7 +368,7 @@ public function testEmitsDataFromConnection()
368
368
$ connection ->write ('foo ' );
369
369
});
370
370
371
- $ data = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
371
+ $ data = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
372
372
373
373
$ this ->assertEquals ('foo ' , $ data );
374
374
@@ -408,7 +408,7 @@ public function testEmitsDataInMultipleChunksFromConnection()
408
408
$ connection ->write (str_repeat ('* ' , 400000 ));
409
409
});
410
410
411
- $ received = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
411
+ $ received = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
412
412
413
413
$ this ->assertEquals (400000 , $ received );
414
414
@@ -450,7 +450,7 @@ public function testPipesDataBackInMultipleChunksFromConnection()
450
450
}, $ reject );
451
451
});
452
452
453
- $ received = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
453
+ $ received = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
454
454
455
455
$ this ->assertEquals (400000 , $ received );
456
456
@@ -480,7 +480,7 @@ public function testEmitsConnectionForNewTlsv11Connection()
480
480
));
481
481
$ promise = $ connector ->connect ($ server ->getAddress ());
482
482
483
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
483
+ \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
484
484
485
485
$ server ->close ();
486
486
$ promise ->then (function (ConnectionInterface $ connection ) {
@@ -511,7 +511,7 @@ public function testEmitsErrorForClientWithTlsVersionMismatch()
511
511
$ this ->setExpectedException ('RuntimeException ' , 'handshake ' );
512
512
513
513
try {
514
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
514
+ \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
515
515
} catch (\Exception $ e ) {
516
516
$ server ->close ();
517
517
@@ -537,7 +537,7 @@ public function testServerEmitsConnectionForNewConnectionWithEncryptedCertificat
537
537
));
538
538
$ connector ->connect ($ server ->getAddress ());
539
539
540
- $ connection = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ peer , self ::TIMEOUT ));
540
+ $ connection = \React \Async \await (\React \Promise \Timer \timeout ($ peer , self ::TIMEOUT ));
541
541
542
542
$ this ->assertInstanceOf ('React\Socket\ConnectionInterface ' , $ connection );
543
543
@@ -560,7 +560,7 @@ public function testClientRejectsWithErrorForServerWithInvalidCertificate()
560
560
$ this ->setExpectedException ('RuntimeException ' , 'handshake ' );
561
561
562
562
try {
563
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
563
+ \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
564
564
} catch (\Exception $ e ) {
565
565
$ server ->close ();
566
566
@@ -590,7 +590,7 @@ public function testServerEmitsErrorForClientWithInvalidCertificate()
590
590
$ this ->setExpectedException ('RuntimeException ' , 'handshake ' );
591
591
592
592
try {
593
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ peer , self ::TIMEOUT ));
593
+ \React \Async \await (\React \Promise \Timer \timeout ($ peer , self ::TIMEOUT ));
594
594
} catch (\Exception $ e ) {
595
595
$ server ->close ();
596
596
@@ -619,7 +619,7 @@ public function testEmitsErrorForServerWithEncryptedCertificateMissingPassphrase
619
619
$ this ->setExpectedException ('RuntimeException ' , 'handshake ' );
620
620
621
621
try {
622
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
622
+ \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
623
623
} catch (\Exception $ e ) {
624
624
$ server ->close ();
625
625
@@ -649,7 +649,7 @@ public function testEmitsErrorForServerWithEncryptedCertificateWithInvalidPassph
649
649
$ this ->setExpectedException ('RuntimeException ' , 'handshake ' );
650
650
651
651
try {
652
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
652
+ \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
653
653
} catch (\Exception $ e ) {
654
654
$ server ->close ();
655
655
@@ -672,7 +672,7 @@ public function testEmitsErrorForConnectionWithPeerVerification()
672
672
$ promise = $ connector ->connect ($ server ->getAddress ());
673
673
$ promise ->then (null , $ this ->expectCallableOnce ());
674
674
675
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
675
+ \React \Async \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
676
676
677
677
$ server ->close ();
678
678
}
@@ -697,7 +697,7 @@ public function testEmitsErrorIfConnectionIsCancelled()
697
697
$ promise ->cancel ();
698
698
$ promise ->then (null , $ this ->expectCallableOnce ());
699
699
700
- \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
700
+ \React \Async \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
701
701
702
702
$ server ->close ();
703
703
}
@@ -718,7 +718,7 @@ public function testEmitsErrorIfConnectionIsClosedBeforeHandshake()
718
718
$ stream ->close ();
719
719
});
720
720
721
- $ error = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
721
+ $ error = \React \Async \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
722
722
723
723
// Connection from tcp://127.0.0.1:39528 failed during TLS handshake: Connection lost during TLS handshake (ECONNRESET)
724
724
$ this ->assertInstanceOf ('RuntimeException ' , $ error );
@@ -746,7 +746,7 @@ public function testEmitsErrorIfConnectionIsClosedWithIncompleteHandshake()
746
746
$ stream ->end ("\x1e" );
747
747
});
748
748
749
- $ error = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
749
+ $ error = \React \Async \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
750
750
751
751
// Connection from tcp://127.0.0.1:39528 failed during TLS handshake: Connection lost during TLS handshake (ECONNRESET)
752
752
$ this ->assertInstanceOf ('RuntimeException ' , $ error );
@@ -770,7 +770,7 @@ public function testEmitsNothingIfPlaintextConnectionIsIdle()
770
770
$ connector = new TcpConnector ();
771
771
$ promise = $ connector ->connect (str_replace ('tls:// ' , '' , $ server ->getAddress ()));
772
772
773
- $ connection = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
773
+ $ connection = \React \Async \await (\React \Promise \Timer \timeout ($ promise , self ::TIMEOUT ));
774
774
$ this ->assertInstanceOf ('React\Socket\ConnectionInterface ' , $ connection );
775
775
776
776
$ server ->close ();
@@ -795,7 +795,7 @@ public function testEmitsErrorIfConnectionIsHttpInsteadOfSecureHandshake()
795
795
$ stream ->write ("GET / HTTP/1.0 \r\n\r\n" );
796
796
});
797
797
798
- $ error = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
798
+ $ error = \React \Async \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
799
799
800
800
$ this ->assertInstanceOf ('RuntimeException ' , $ error );
801
801
@@ -824,7 +824,7 @@ public function testEmitsErrorIfConnectionIsUnknownProtocolInsteadOfSecureHandsh
824
824
$ stream ->write ("Hello world! \n" );
825
825
});
826
826
827
- $ error = \Clue \ React \Block \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
827
+ $ error = \React \Async \await (\React \Promise \Timer \timeout ($ errorEvent , self ::TIMEOUT ));
828
828
829
829
$ this ->assertInstanceOf ('RuntimeException ' , $ error );
830
830
0 commit comments