GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: remove common.port from test-tls-securepair-client · nodejs/node@be90817

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/sequential
    • test-tls-securepair-client.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/sequential/test-tls-securepair-client.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-tls-securepair-client.js
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function test(keyPath, certPath, check, next) {
6262
const cert = fixtures.readSync(certPath).toString();
6363

6464
const server = spawn(common.opensslCli, ['s_server',
65-
'-accept', common.PORT,
65+
'-accept', 0,
6666
'-cert', fixtures.path(certPath),
6767
'-key', fixtures.path(keyPath)]);
6868
server.stdout.pipe(process.stdout);
@@ -78,10 +78,11 @@ function test(keyPath, certPath, check, next) {
7878
console.log(state);
7979
switch (state) {
8080
case 'WAIT-ACCEPT':
81-
if (/ACCEPT/.test(serverStdoutBuffer)) {
82-
// Give s_server half a second to start up.
83-
setTimeout(startClient, 500);
81+
const matches = serverStdoutBuffer.match(/ACCEPT .*?:(\d+)/);
82+
if (matches) {
83+
const port = matches[1];
8484
state = 'WAIT-HELLO';
85+
startClient(port);
8586
}
8687
break;
8788

@@ -117,7 +118,7 @@ function test(keyPath, certPath, check, next) {
117118
});
118119

119120

120-
function startClient() {
121+
function startClient(port) {
121122
const s = new net.Stream();
122123

123124
const sslcontext = tls.createSecureContext({ key, cert });
@@ -131,7 +132,7 @@ function test(keyPath, certPath, check, next) {
131132
pair.encrypted.pipe(s);
132133
s.pipe(pair.encrypted);
133134

134-
s.connect(common.PORT);
135+
s.connect(port);
135136

136137
s.on('connect', function() {
137138
console.log('client connected');

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.