title: How to use tlsSocket.renegotiate(options, callback) in Node.js 0.11.8 and higher
body: <p>I'm new to node.js and I have a simple https server running. Now when a user requests a certain context path the server should initiate a SSL renegotiation and ask for a client certificate authentication. I saw that this is supported in node.js 0.11.8 and higher.</p>
  
  <p>I tried this so far, but a renegotiation is not happening. Not even an error is thrown.</p>
  
  <pre><code>var https = require('https');
  var fs = require('fs');
  
  var optSsl = {
     key: fs.readFileSync('ssl/server/keys/server.key'),
     cert: fs.readFileSync('ssl/server/certs/server.crt'),
     ca: fs.readFileSync('ssl/ca/ca.crt'),
     requestCert: false,
     rejectUnauthorized: true,
     ciphers: 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS',
     honorCipherOrder: true
  };
  
  var optClientAuth = {
      requestCert: true,
      rejectUnauthorized: true
  };
  
  var server = https.createServer(optSsl, function(req, res){
      res.writeHead(200);
      res.end("Hello World\n");
  });
  
  server.on('request', function(req, res){
      console.log('request emitted on ' + req.url);
      if (req.url == '/secure') {
          try {
              var socket = req.connection;
              socket.renegotiate(optClientAuth, function(err){
                  if (!err) {
                      console.log(req.connection.getPeerCertificate());
                  } else {
                      console.log(err.message);
                  }
              });
          } catch (err) {
              console.log(err);
          }
      };
  });
  
  server.on('secureConnection', function(socket) {
      console.log('Secure connection established');
  });
  
  server.listen(8443);
  </code></pre>
  
  <p>Thank you for your support.</p>