33namespace Clue \Tests \React \SshProxy ;
44
55use Clue \React \SshProxy \SshSocksConnector ;
6- use React \EventLoop \Loop ;
76
87class FunctionalSshSocksConnectorTest extends TestCase
98{
@@ -30,7 +29,7 @@ public function setUpConnector()
3029 public function tearDownSSHClientProcess ()
3130 {
3231 // run loop in order to shut down SSH client process again
33- \Clue \ React \Block \ sleep (0.001 , Loop:: get ( ));
32+ \React \ Async \await ( \ React \Promise \ Timer \ sleep (0.001 ));
3433 }
3534
3635 public function testConnectInvalidProxyUriWillReturnRejectedPromise ()
@@ -40,15 +39,15 @@ public function testConnectInvalidProxyUriWillReturnRejectedPromise()
4039 $ promise = $ this ->connector ->connect ('example.com:80 ' );
4140
4241 $ this ->setExpectedException ('RuntimeException ' , 'Connection to example.com:80 failed because SSH client process died ' );
43- \Clue \ React \Block \await ($ promise , Loop:: get (), self ::TIMEOUT );
42+ \React \Async \await (\ React \ Promise \ Timer \timeout ( $ promise , self ::TIMEOUT ) );
4443 }
4544
4645 public function testConnectInvalidTargetWillReturnRejectedPromise ()
4746 {
4847 $ promise = $ this ->connector ->connect ('example.invalid:80 ' );
4948
5049 $ this ->setExpectedException ('RuntimeException ' , 'Connection to tcp://example.invalid:80 failed because connection to proxy was lost ' );
51- \Clue \ React \Block \await ($ promise , Loop:: get (), self ::TIMEOUT );
50+ \React \Async \await (\ React \ Promise \ Timer \timeout ( $ promise , self ::TIMEOUT ) );
5251 }
5352
5453 public function testCancelConnectWillReturnRejectedPromise ()
@@ -57,14 +56,14 @@ public function testCancelConnectWillReturnRejectedPromise()
5756 $ promise ->cancel ();
5857
5958 $ this ->setExpectedException ('RuntimeException ' , 'Connection to example.com:80 cancelled while waiting for SSH client ' );
60- \Clue \ React \Block \await ($ promise , Loop:: get (), 0 );
59+ \React \Async \await (\ React \ Promise \ Timer \timeout ( $ promise , 0 ) );
6160 }
6261
6362 public function testConnectValidTargetWillReturnPromiseWhichResolvesToConnection ()
6463 {
6564 $ promise = $ this ->connector ->connect ('example.com:80 ' );
6665
67- $ connection = \Clue \ React \Block \await ($ promise , Loop:: get (), self ::TIMEOUT );
66+ $ connection = \React \Async \await (\ React \ Promise \ Timer \timeout ( $ promise , self ::TIMEOUT ) );
6867
6968 $ this ->assertInstanceOf ('React\Socket\ConnectionInterface ' , $ connection );
7069 $ this ->assertTrue ($ connection ->isReadable ());
@@ -74,10 +73,10 @@ public function testConnectValidTargetWillReturnPromiseWhichResolvesToConnection
7473
7574 public function testConnectValidTargetWillReturnPromiseWhichResolvesToConnectionForCustomBindAddress ()
7675 {
77- $ this ->connector = new SshSocksConnector (getenv ('SSH_PROXY ' ) . '?bind=127.0.0.1:1081 ' , Loop:: get () );
76+ $ this ->connector = new SshSocksConnector (getenv ('SSH_PROXY ' ) . '?bind=127.0.0.1:1081 ' );
7877 $ promise = $ this ->connector ->connect ('example.com:80 ' );
7978
80- $ connection = \Clue \ React \Block \await ($ promise , Loop:: get (), self ::TIMEOUT );
79+ $ connection = \React \Async \await (\ React \ Promise \ Timer \timeout ( $ promise , self ::TIMEOUT ) );
8180
8281 $ this ->assertInstanceOf ('React\Socket\ConnectionInterface ' , $ connection );
8382 $ this ->assertTrue ($ connection ->isReadable ());
0 commit comments