function createHttpsSNIServer(port, handler) {
  assert(port && handler, 'invalid param for https SNI server');

  const createSecureContext = tls.createSecureContext || crypto.createSecureContext;
  function SNIPrepareCert(serverName, SNICallback) {
    let keyContent,
      crtContent,
      ctx;
  
    async.series([
      (callback) => {
        certMgr.getCertificate(serverName, (err, key, crt) => {
          if (err) {
            callback(err);
          } else {
            keyContent = key;
            crtContent = crt;
            callback();
          }
        });
      },
      (callback) => {
        try {
          ctx = createSecureContext({
            key: keyContent,
            cert: crtContent
          });
          callback();
        } catch (e) {
          callback(e);
        }
      }
    ], (err) => {
      if (!err) {
        const tipText = 'proxy server for __NAME established'.replace('__NAME', serverName);
        logUtil.printLog(color.yellow(color.bold('[internal https]')) + color.yellow(tipText));
        SNICallback(null, ctx);
      } else {
        logUtil.printLog('err occurred when prepare certs for SNI - ' + err, logUtil.T_ERR);
        logUtil.printLog('err occurred when prepare certs for SNI - ' + err.stack, logUtil.T_ERR);
        SNICallback(err);
      }
    });
  }

  return new Promise((resolve) => {
    const server = https.createServer({
      secureOptions: constants.SSL_OP_NO_SSLv3 || constants.SSL_OP_NO_TLSv1,
      SNICallback: SNIPrepareCert,
    }, handler).listen(port);
    resolve(server);
  });
}
Create an https server

@param {object} config
@param {number} config.port
@param {function} config.handler