77use Clue \React \Quassel \Factory ;
88use Clue \React \Quassel \Io \Protocol ;
99use React \EventLoop \Loop ;
10- use React \Socket \Server ;
10+ use React \Socket \SocketServer ;
1111use React \Socket \ConnectionInterface ;
1212
1313class FactoryIntegrationTest extends TestCase
1414{
1515 public function testCreateClientCreatesConnection ()
1616 {
17- $ server = new Server ( 0 );
17+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
1818 $ server ->on ('connection ' , $ this ->expectCallableOnce ());
1919
2020 $ uri = str_replace ('tcp:// ' , '' , $ server ->getAddress ());
@@ -26,7 +26,7 @@ public function testCreateClientCreatesConnection()
2626
2727 public function testCreateClientSendsProbeOverConnection ()
2828 {
29- $ server = new Server ( 0 );
29+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
3030
3131 $ data = $ this ->expectCallableOnceWith ("\x42\xb3\x3f\x00" . "\x00\x00\x00\x02" . "\x80\x00\x00\x01" );
3232 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) use ($ data ) {
@@ -42,7 +42,7 @@ public function testCreateClientSendsProbeOverConnection()
4242
4343 public function testCreateClientResolvesIfServerRespondsWithProbeResponse ()
4444 {
45- $ server = new Server ( 0 );
45+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
4646
4747 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
4848 $ conn ->on ('data ' , function () use ($ conn ) {
@@ -62,7 +62,7 @@ public function testCreateClientResolvesIfServerRespondsWithProbeResponse()
6262
6363 public function testCreateClientCreatesSecondConnectionWithoutProbeIfConnectionClosesDuringProbe ()
6464 {
65- $ server = new Server ( 0 );
65+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
6666
6767 $ once = $ this ->expectCallableOnce ();
6868 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) use ($ once ) {
@@ -81,7 +81,7 @@ public function testCreateClientCreatesSecondConnectionWithoutProbeIfConnectionC
8181
8282 public function testCreateClientRejectsIfServerRespondsWithInvalidData ()
8383 {
84- $ server = new Server ( 0 );
84+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
8585
8686 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
8787 $ conn ->on ('data ' , function () use ($ conn ) {
@@ -99,7 +99,7 @@ public function testCreateClientRejectsIfServerRespondsWithInvalidData()
9999
100100 public function testCreateClientWithAuthSendsClientInitAfterProbe ()
101101 {
102- $ server = new Server ( 0 );
102+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
103103
104104 $ data = $ this ->expectCallableOnceWith ($ this ->callback (function ($ packet ) {
105105 $ data = FactoryIntegrationTest::decode ($ packet );
@@ -123,7 +123,7 @@ public function testCreateClientWithAuthSendsClientInitAfterProbe()
123123
124124 public function testCreateClientWithAuthRejectsIfServerClosesAfterClientInit ()
125125 {
126- $ server = new Server ( 0 );
126+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
127127
128128 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
129129 $ conn ->on ('data ' , function () use ($ conn ) {
@@ -144,7 +144,7 @@ public function testCreateClientWithAuthRejectsIfServerClosesAfterClientInit()
144144
145145 public function testCreateClientWithAuthRejectsIfServerSendsClientInitRejectAfterClientInit ()
146146 {
147- $ server = new Server ( 0 );
147+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
148148
149149 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
150150 $ conn ->once ('data ' , function () use ($ conn ) {
@@ -170,7 +170,7 @@ public function testCreateClientWithAuthRejectsIfServerSendsClientInitRejectAfte
170170
171171 public function testCreateClientWithAuthRejectsIfServerSendsUnknownMessageAfterClientInit ()
172172 {
173- $ server = new Server ( 0 );
173+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
174174
175175 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
176176 $ conn ->once ('data ' , function () use ($ conn ) {
@@ -196,7 +196,7 @@ public function testCreateClientWithAuthRejectsIfServerSendsUnknownMessageAfterC
196196
197197 public function testCreateClientWithAuthRejectsIfServerSendsInvalidTruncatedResponseAfterClientInit ()
198198 {
199- $ server = new Server ( 0 );
199+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
200200
201201 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
202202 $ conn ->once ('data ' , function () use ($ conn ) {
@@ -217,7 +217,7 @@ public function testCreateClientWithAuthRejectsIfServerSendsInvalidTruncatedResp
217217
218218 public function testCreateClientWithAuthRejectsIfServerSendsClientInitAckNotConfigured ()
219219 {
220- $ server = new Server ( 0 );
220+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
221221
222222 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
223223 $ conn ->once ('data ' , function () use ($ conn ) {
@@ -242,7 +242,7 @@ public function testCreateClientWithAuthRejectsIfServerSendsClientInitAckNotConf
242242
243243 public function testCreateClientWithAuthSendsClientLoginAfterClientInit ()
244244 {
245- $ server = new Server ( 0 );
245+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
246246
247247 // expect login packet
248248 $ data = $ this ->expectCallableOnceWith ($ this ->callback (function ($ packet ) {
@@ -277,7 +277,7 @@ public function testCreateClientWithAuthSendsClientLoginAfterClientInit()
277277
278278 public function testCreateClientRespondsWithHeartBeatResponseAfterHeartBeatRequest ()
279279 {
280- $ server = new Server ( 0 );
280+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
281281
282282 // expect heartbeat response packet
283283 $ data = $ this ->expectCallableOnceWith ($ this ->callback (function ($ packet ) {
@@ -316,7 +316,7 @@ public function testCreateClientRespondsWithHeartBeatResponseAfterHeartBeatReque
316316
317317 public function testCreateClientDoesNotRespondWithHeartBeatResponseIfPongIsDisabled ()
318318 {
319- $ server = new Server ( 0 );
319+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
320320
321321 // expect no message in response
322322 $ data = $ this ->expectCallableNever ();
@@ -350,7 +350,7 @@ public function testCreateClientDoesNotRespondWithHeartBeatResponseIfPongIsDisab
350350
351351 public function testCreateClientSendsHeartBeatRequestAtInterval ()
352352 {
353- $ server = new Server ( 0 );
353+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
354354
355355 // expect heartbeat response packet
356356 $ data = $ this ->expectCallableOnceWith ($ this ->callback (function ($ packet ) {
@@ -381,7 +381,7 @@ public function testCreateClientSendsHeartBeatRequestAtInterval()
381381
382382 public function testCreateClientSendsNoHeartBeatRequestIfServerKeepsSendingMessages ()
383383 {
384- $ server = new Server ( 0 );
384+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
385385
386386 // expect heartbeat response packet
387387 $ data = $ this ->expectCallableNever ();
@@ -412,7 +412,7 @@ public function testCreateClientSendsNoHeartBeatRequestIfServerKeepsSendingMessa
412412
413413 public function testCreateClientClosesWithErrorIfServerDoesNotRespondToHeartBeatRequests ()
414414 {
415- $ server = new Server ( 0 );
415+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
416416
417417 $ server ->on ('connection ' , function (ConnectionInterface $ conn ) {
418418 $ conn ->once ('data ' , function () use ($ conn ) {
@@ -433,7 +433,7 @@ public function testCreateClientClosesWithErrorIfServerDoesNotRespondToHeartBeat
433433
434434 public function testCreateClientSendsNoHeartBeatRequestIfPingIsDisabled ()
435435 {
436- $ server = new Server ( 0 );
436+ $ server = new SocketServer ( ' 127.0.0.1:0 ' );
437437
438438 // expect heartbeat response packet
439439 $ data = $ this ->expectCallableNever ();
0 commit comments