Fix TlsTransport test.

GitOrigin-RevId: bc5da0b5077558ac80d7ce736ef1063c2392ce05
This commit is contained in:
levlam 2019-07-07 03:35:30 +03:00
parent e300208960
commit 8a94ce1458

View File

@ -599,14 +599,16 @@ TEST(Mtproto, Grease) {
} }
} }
TEST(Mtproto, TlsObfusaction) { TEST(Mtproto, TlsTransport) {
std::string domain = "www.google.com";
SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR)); SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR));
ConcurrentScheduler sched; ConcurrentScheduler sched;
int threads_n = 1; int threads_n = 1;
sched.init(threads_n); sched.init(threads_n);
{ {
auto guard = sched.get_main_guard(); auto guard = sched.get_main_guard();
class RunTest : public Actor {
private:
void start_up() override {
class Callback : public TransparentProxy::Callback { class Callback : public TransparentProxy::Callback {
public: public:
void set_result(Result<SocketFd> result) override { void set_result(Result<SocketFd> result) override {
@ -616,13 +618,18 @@ TEST(Mtproto, TlsObfusaction) {
void on_connected() override { void on_connected() override {
} }
}; };
const std::string domain = "www.google.com";
IPAddress ip_address; IPAddress ip_address;
ip_address.init_host_port(domain, 443).ensure(); ip_address.init_host_port(domain, 443).ensure();
SocketFd fd = SocketFd::open(ip_address).move_as_ok(); SocketFd fd = SocketFd::open(ip_address).move_as_ok();
create_actor<TlsInit>("TlsInit", std::move(fd), IPAddress(), domain, "0123456789secret", make_unique<Callback>(), create_actor<TlsInit>("TlsInit", std::move(fd), IPAddress(), domain, "0123456789secret",
ActorShared<>(), Clocks::system() - Time::now()) make_unique<Callback>(), ActorShared<>(), Clocks::system() - Time::now())
.release(); .release();
} }
};
create_actor<RunTest>("RunTest").release();
}
sched.start(); sched.start();
while (sched.run_main(10)) { while (sched.run_main(10)) {