325 Star 1.6K Fork 345

GVPswoole / swoole-src

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
00.phpt 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
韩天峰 提交于 2021-11-19 19:57 . Replace psr0 to psr4 (#4500)
--TEST--
swoole_server/ssl: basic
--SKIPIF--
<?php require __DIR__ . '/../../include/skipif.inc'; ?>
--FILE--
<?php
require __DIR__ . '/../../include/bootstrap.php';
$pm = new SwooleTest\ProcessManager;
$pm->parentFunc = function ($pid) use ($pm) {
$client = new Swoole\Client(SWOOLE_SOCK_TCP | SWOOLE_SSL, SWOOLE_SOCK_SYNC); //同步阻塞
if (!$client->connect('127.0.0.1', $pm->getFreePort()))
{
exit("connect failed\n");
}
$client->send("hello world");
Assert::same($client->recv(), "Swoole hello world");
$pm->kill();
};
$pm->childFunc = function () use ($pm) {
$serv = new Swoole\Server('127.0.0.1', $pm->getFreePort(), SWOOLE_BASE, SWOOLE_SOCK_TCP | SWOOLE_SSL);
$serv->set([
'log_file' => '/dev/null',
'ssl_cert_file' => SSL_FILE_DIR . '/server.crt',
'ssl_key_file' => SSL_FILE_DIR . '/server.key',
]);
$serv->on("workerStart", function ($serv) use ($pm) {
$pm->wakeup();
});
$serv->on('receive', function ($serv, $fd, $tid, $data) {
$serv->send($fd, "Swoole $data");
});
$serv->start();
};
$pm->childFirst();
$pm->run();
?>
--EXPECT--
C
1
https://gitee.com/swoole/swoole.git
git@gitee.com:swoole/swoole.git
swoole
swoole
swoole-src
master

搜索帮助