Skip to content

Instantly share code, notes, and snippets.

@vicapow
Created October 18, 2012 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vicapow/3912933 to your computer and use it in GitHub Desktop.
Save vicapow/3912933 to your computer and use it in GitHub Desktop.
var client_opts = {
// These are necessary only if using the client certificate authentication
key : fs.readFileSync('client-key.pem')
, cert : fs.readFileSync('client-cert.pem')
, ca: [ fs.readFileSync('server-cert.pem') ]
, port : port
};
var cleartextStream = tls.connect(client_opts, function() {
console.log('client connected',
process.stdin.pipe(cleartextStream);
process.stdin.resume();
});
cleartextStream.setEncoding('utf8');
cleartextStream.on('error',function(e){
throw e
})
cleartextStream.on('data', function(data) {
console.log(data);
});
cleartextStream.on('end', function() {
server.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment