@@ -17,8 +17,8 @@ public function createClient($options = array())
17
17
18
18
public function testTcpSocketDomain ()
19
19
{
20
- $ this ->startServer ('tcp-server ' );
21
- $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1:19999 ' ]);
20
+ $ port = $ this ->startServer ('tcp-server ' );
21
+ $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1: ' . $ port ]);
22
22
$ response = $ client ->get ('/ ' , []);
23
23
24
24
$ this ->assertInstanceOf ('Psr\Http\Message\ResponseInterface ' , $ response );
@@ -36,19 +36,19 @@ public function testNoRemote()
36
36
37
37
public function testRemoteInUri ()
38
38
{
39
- $ this ->startServer ('tcp-server ' );
39
+ $ port = $ this ->startServer ('tcp-server ' );
40
40
$ client = $ this ->createClient ();
41
- $ response = $ client ->get ('http://127.0.0.1:19999 / ' , []);
41
+ $ response = $ client ->get ('http://127.0.0.1: ' . $ port . ' / ' , []);
42
42
43
43
$ this ->assertInstanceOf ('Psr\Http\Message\ResponseInterface ' , $ response );
44
44
$ this ->assertEquals (200 , $ response ->getStatusCode ());
45
45
}
46
46
47
47
public function testRemoteInHostHeader ()
48
48
{
49
- $ this ->startServer ('tcp-server ' );
49
+ $ port = $ port = $ this ->startServer ('tcp-server ' );
50
50
$ client = $ this ->createClient ();
51
- $ response = $ client ->get ('/ ' , ['Host ' => '127.0.0.1:19999 ' ]);
51
+ $ response = $ client ->get ('/ ' , ['Host ' => '127.0.0.1: ' . $ port ]);
52
52
53
53
$ this ->assertInstanceOf ('Psr\Http\Message\ResponseInterface ' , $ response );
54
54
$ this ->assertEquals (200 , $ response ->getStatusCode ());
@@ -59,14 +59,14 @@ public function testRemoteInHostHeader()
59
59
*/
60
60
public function testBrokenSocket ()
61
61
{
62
- $ this ->startServer ('tcp-bugous-server ' );
63
- $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1:19999 ' ]);
62
+ $ port = $ this ->startServer ('tcp-bugous-server ' );
63
+ $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1: ' . $ port ]);
64
64
$ client ->get ('/ ' , []);
65
65
}
66
66
67
67
public function testSslRemoteInUri ()
68
68
{
69
- $ this ->startServer ('tcp-ssl-server ' );
69
+ $ port = $ this ->startServer ('tcp-ssl-server ' );
70
70
$ client = $ this ->createClient ([
71
71
'stream_context_options ' => [
72
72
'ssl ' => [
@@ -75,7 +75,7 @@ public function testSslRemoteInUri()
75
75
]
76
76
]
77
77
]);
78
- $ response = $ client ->get ('https://127.0.0.1:19999 / ' , []);
78
+ $ response = $ client ->get ('https://127.0.0.1: ' . $ port . ' / ' , []);
79
79
80
80
$ this ->assertInstanceOf ('Psr\Http\Message\ResponseInterface ' , $ response );
81
81
$ this ->assertEquals (200 , $ response ->getStatusCode ());
@@ -99,16 +99,16 @@ public function testUnixSocketDomain()
99
99
*/
100
100
public function testNetworkExceptionOnConnectError ()
101
101
{
102
- $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1:19999 ' ]);
102
+ $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1:19999 ' ]);
103
103
$ client ->get ('/ ' , []);
104
104
}
105
105
106
106
public function testSslConnection ()
107
107
{
108
- $ this ->startServer ('tcp-ssl-server ' );
108
+ $ port = $ this ->startServer ('tcp-ssl-server ' );
109
109
110
110
$ client = $ this ->createClient ([
111
- 'remote_socket ' => '127.0.0.1:19999 ' ,
111
+ 'remote_socket ' => '127.0.0.1: ' . $ port ,
112
112
'ssl ' => true ,
113
113
'stream_context_options ' => [
114
114
'ssl ' => [
@@ -129,10 +129,10 @@ public function testSslConnectionWithClientCertificate()
129
129
$ this ->markTestSkipped ('Test can only run on php 5.6 and superior (for capturing peer certificate) ' );
130
130
}
131
131
132
- $ this ->startServer ('tcp-ssl-server-client ' );
132
+ $ port = $ this ->startServer ('tcp-ssl-server-client ' );
133
133
134
134
$ client = $ this ->createClient ([
135
- 'remote_socket ' => '127.0.0.1:19999 ' ,
135
+ 'remote_socket ' => '127.0.0.1: ' . $ port ,
136
136
'ssl ' => true ,
137
137
'stream_context_options ' => [
138
138
'ssl ' => [
@@ -154,10 +154,10 @@ public function testInvalidSslConnectionWithClientCertificate()
154
154
$ this ->markTestSkipped ('Test can only run on php 5.6 and superior (for capturing peer certificate) ' );
155
155
}
156
156
157
- $ this ->startServer ('tcp-ssl-server-client ' );
157
+ $ port = $ this ->startServer ('tcp-ssl-server-client ' );
158
158
159
159
$ client = $ this ->createClient ([
160
- 'remote_socket ' => '127.0.0.1:19999 ' ,
160
+ 'remote_socket ' => '127.0.0.1: ' . $ port ,
161
161
'ssl ' => true ,
162
162
'stream_context_options ' => [
163
163
'ssl ' => [
@@ -177,9 +177,9 @@ public function testInvalidSslConnectionWithClientCertificate()
177
177
*/
178
178
public function testNetworkExceptionOnSslError ()
179
179
{
180
- $ this ->startServer ('tcp-server ' );
180
+ $ port = $ this ->startServer ('tcp-server ' );
181
181
182
- $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1:19999 ' , 'ssl ' => true ]);
182
+ $ client = $ this ->createClient (['remote_socket ' => '127.0.0.1: ' . $ port , 'ssl ' => true ]);
183
183
$ client ->get ('/ ' , []);
184
184
}
185
185
0 commit comments