@@ -81,7 +81,7 @@ public function testPassByResolverIfGivenIp()
8181 public function testPassByResolverIfGivenIpv6 ()
8282 {
8383 $ this ->resolver ->expects ($ this ->never ())->method ('resolveAll ' );
84- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80 ' ))->will ($ this ->returnValue (Promise \reject ()));
84+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80 ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
8585
8686 $ this ->connector ->connect ('[::1]:80 ' );
8787
@@ -91,7 +91,7 @@ public function testPassByResolverIfGivenIpv6()
9191 public function testPassThroughResolverIfGivenHost ()
9292 {
9393 $ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
94- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
94+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
9595
9696 $ this ->connector ->connect ('google.com:80 ' );
9797
@@ -101,7 +101,7 @@ public function testPassThroughResolverIfGivenHost()
101101 public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6 ()
102102 {
103103 $ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('::1 ' ))));
104- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
104+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
105105
106106 $ this ->connector ->connect ('google.com:80 ' );
107107
@@ -111,7 +111,7 @@ public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6()
111111 public function testPassByResolverIfGivenCompleteUri ()
112112 {
113113 $ this ->resolver ->expects ($ this ->never ())->method ('resolveAll ' );
114- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
114+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
115115
116116 $ this ->connector ->connect ('scheme://127.0.0.1:80/path?query#fragment ' );
117117
@@ -121,7 +121,7 @@ public function testPassByResolverIfGivenCompleteUri()
121121 public function testPassThroughResolverIfGivenCompleteUri ()
122122 {
123123 $ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
124- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
124+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
125125
126126 $ this ->connector ->connect ('scheme://google.com:80/path?query#fragment ' );
127127
@@ -131,7 +131,7 @@ public function testPassThroughResolverIfGivenCompleteUri()
131131 public function testPassThroughResolverIfGivenExplicitHost ()
132132 {
133133 $ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
134- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject ()));
134+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
135135
136136 $ this ->connector ->connect ('scheme://google.com:80/?hostname=google.de ' );
137137
@@ -171,12 +171,12 @@ public function testIpv6ResolvesFirstSoIsTheFirstToConnect(array $ipv6, array $i
171171
172172 $ this ->resolver ->expects ($ this ->at (0 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_AAAA )->will ($ this ->returnValue (Promise \resolve ($ ipv6 )));
173173 $ this ->resolver ->expects ($ this ->at (1 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_A )->will ($ this ->returnValue ($ deferred ->promise ()));
174- $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
174+ $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
175175
176176 $ this ->connector ->connect ('scheme://google.com:80/?hostname=google.com ' );
177177
178178 $ this ->loop ->addTimer (0.07 , function () use ($ deferred ) {
179- $ deferred ->reject ();
179+ $ deferred ->reject (new \ Exception ( ' reject ' ) );
180180 });
181181
182182 $ this ->loop ->run ();
@@ -191,12 +191,12 @@ public function testIpv6DoesntResolvesWhileIpv4DoesFirstSoIpv4Connects(array $ip
191191
192192 $ this ->resolver ->expects ($ this ->at (0 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_AAAA )->will ($ this ->returnValue ($ deferred ->promise ()));
193193 $ this ->resolver ->expects ($ this ->at (1 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_A )->will ($ this ->returnValue (Promise \resolve ($ ipv4 )));
194- $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
194+ $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
195195
196196 $ this ->connector ->connect ('scheme://google.com:80/?hostname=google.com ' );
197197
198198 $ this ->loop ->addTimer (0.07 , function () use ($ deferred ) {
199- $ deferred ->reject ();
199+ $ deferred ->reject (new \ Exception ( ' reject ' ) );
200200 });
201201
202202 $ this ->loop ->run ();
@@ -290,10 +290,10 @@ public function testAttemptsToConnectBothIpv6AndIpv4AddressesAlternatingIpv6AndI
290290 $ i = 0 ;
291291 while (count ($ ipv6 ) > 0 || count ($ ipv4 ) > 0 ) {
292292 if (count ($ ipv6 ) > 0 ) {
293- $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme://[ ' . array_shift ($ ipv6 ) . ']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
293+ $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme://[ ' . array_shift ($ ipv6 ) . ']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
294294 }
295295 if (count ($ ipv4 ) > 0 ) {
296- $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme:// ' . array_shift ($ ipv4 ) . ':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
296+ $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme:// ' . array_shift ($ ipv4 ) . ':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
297297 }
298298 }
299299
0 commit comments