@@ -52,8 +52,6 @@ public function connectionToTcpServerShouldSucceed()
5252 $ loop = Factory::create ();
5353
5454 $ server = new TcpServer (9999 , $ loop );
55- $ server ->on ('connection ' , $ this ->expectCallableOnce ());
56- $ server ->on ('connection ' , array ($ server , 'close ' ));
5755
5856 $ connector = new TcpConnector ($ loop );
5957
@@ -62,6 +60,7 @@ public function connectionToTcpServerShouldSucceed()
6260 $ this ->assertInstanceOf ('React\Socket\ConnectionInterface ' , $ connection );
6361
6462 $ connection ->close ();
63+ $ server ->close ();
6564 }
6665
6766 /**
@@ -101,7 +100,6 @@ public function connectionToTcpServerShouldSucceedWithRemoteAdressSameAsTarget()
101100 $ loop = Factory::create ();
102101
103102 $ server = new TcpServer (9999 , $ loop );
104- $ server ->on ('connection ' , array ($ server , 'close ' ));
105103
106104 $ connector = new TcpConnector ($ loop );
107105
@@ -111,6 +109,7 @@ public function connectionToTcpServerShouldSucceedWithRemoteAdressSameAsTarget()
111109 $ this ->assertEquals ('tcp://127.0.0.1:9999 ' , $ connection ->getRemoteAddress ());
112110
113111 $ connection ->close ();
112+ $ server ->close ();
114113 }
115114
116115 /** @test */
@@ -119,7 +118,6 @@ public function connectionToTcpServerShouldSucceedWithLocalAdressOnLocalhost()
119118 $ loop = Factory::create ();
120119
121120 $ server = new TcpServer (9999 , $ loop );
122- $ server ->on ('connection ' , array ($ server , 'close ' ));
123121
124122 $ connector = new TcpConnector ($ loop );
125123
@@ -130,6 +128,7 @@ public function connectionToTcpServerShouldSucceedWithLocalAdressOnLocalhost()
130128 $ this ->assertNotEquals ('tcp://127.0.0.1:9999 ' , $ connection ->getLocalAddress ());
131129
132130 $ connection ->close ();
131+ $ server ->close ();
133132 }
134133
135134 /** @test */
@@ -138,13 +137,13 @@ public function connectionToTcpServerShouldSucceedWithNullAddressesAfterConnecti
138137 $ loop = Factory::create ();
139138
140139 $ server = new TcpServer (9999 , $ loop );
141- $ server ->on ('connection ' , array ($ server , 'close ' ));
142140
143141 $ connector = new TcpConnector ($ loop );
144142
145143 $ connection = Block \await ($ connector ->connect ('127.0.0.1:9999 ' ), $ loop , self ::TIMEOUT );
146144 /* @var $connection ConnectionInterface */
147145
146+ $ server ->close ();
148147 $ connection ->close ();
149148
150149 $ this ->assertNull ($ connection ->getRemoteAddress ());
@@ -197,9 +196,6 @@ public function connectionToIp6TcpServerShouldSucceed()
197196 $ this ->markTestSkipped ('Unable to start IPv6 server socket (IPv6 not supported on this system?) ' );
198197 }
199198
200- $ server ->on ('connection ' , $ this ->expectCallableOnce ());
201- $ server ->on ('connection ' , array ($ server , 'close ' ));
202-
203199 $ connector = new TcpConnector ($ loop );
204200
205201 $ connection = Block \await ($ connector ->connect ('[::1]:9999 ' ), $ loop , self ::TIMEOUT );
@@ -211,6 +207,7 @@ public function connectionToIp6TcpServerShouldSucceed()
211207 $ this ->assertNotEquals ('tcp://[::1]:9999 ' , $ connection ->getLocalAddress ());
212208
213209 $ connection ->close ();
210+ $ server ->close ();
214211 }
215212
216213 /** @test */
0 commit comments