function tests_port($port_id)
{
    $unix = new unix();
    $squid = new squidbee();
    $q = new mysql_squid_builder();
    $ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT * FROM proxy_ports WHERE ID={$port_id}"));
    $ssl_bump_line = $squid->ssl_bump_line($ligne["sslcertificate"]);
    $randport = rand(63500, 65535);
    build_progress("{testing_ssl_certificate} ID:{$port_id} {$ligne["sslcertificate"]}", 15);
    $t = time();
    $pid_filename = "/var/run/squid/{$t}.pid";
    $cache_log = "/var/log/squid/cache.{$t}.log";
    $f[] = "coredump_dir\t/var/squid/cache";
    $f[] = "cache_log\t/var/log/squid/cache.log";
    $f[] = "pid_filename\t/var/run/squid/squid.pid";
    $f[] = "cache_effective_user squid";
    $f[] = "http_port 127.0.0.1:{$randport} {$ssl_bump_line}";
    echo " ***********************************************************************\n";
    echo "Using HTTPS port {$ssl_bump_line} Certificate {$ligne["sslcertificate"]}\n";
    echo " ***********************************************************************\n";
    $f[] = "";
    $tmpfile = $unix->FILE_TEMP();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    build_progress("{testing_ssl_certificate} {$ligne["sslcertificate"]}", 20);
    echo "Conf  : {$tmpfile}\n";
    echo "Binary: {$squidbin}\n";
    @file_put_contents($tmpfile, @implode("\n", $f));
    exec("{$squidbin} -f {$tmpfile} -k check 2>&1", $results);
    @unlink($tmpfile);
    while (list($num, $line) = each($results)) {
        echo "Check  : {$line}\n";
        if (preg_match("#FATAL: No valid signing SSL#", $line)) {
            build_progress("{testing_ssl_certificate_failed} {$ligne["sslcertificate"]}", 110);
            $sql = "UPDATE proxy_ports SET sslcertificate='' WHERE ID='{$port_id}'";
            $q->QUERY_SQL($sql);
            return;
        }
    }
    build_progress("{testing_ssl_certificate} {success}", 100);
    // FATAL: No valid signing SSL certificate
}