code: function createHttpsServer(options, requestHandler, keys) {
    net
      .createServer(function(socket){
        socket.once('data', function(buffer){
          // Pause the socket
          socket.pause();
  
          // Determine if this is an HTTP(s) request
          var byte = buffer[0];
          var proxy;
  
          if (byte === 22)
            proxy = server.https;
          else if (32 < byte && byte < 127)
            proxy = server.http;
  
          if (proxy)
          {
            // Push the buffer back onto the front of the data stream
            socket.unshift(buffer);
  
            // Emit the socket to the HTTP(s) server
            proxy.emit('connection', socket);
          }
  
          // Resume the socket data stream
          socket.resume();
        });
      })
      .on('error', function(error){
        onError(error, options);
      })
      .listen(options.port, function(){
        onListen(this, options);
      });
  
    var server = {
      http: http.createServer(requestHandler),
      https: https.createServer(keys, requestHandler)
    };
  
    return server;
  }
docs: Based on http://stackoverflow.com/a/42019773/685672