mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 19:56:00 +00:00
@@ -19,30 +19,43 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <webserver/WsBase.h>
|
||||
#include <webserver/interface/ConnectionBase.h>
|
||||
|
||||
struct MockSession : public WsBase
|
||||
struct MockSession : public Server::ConnectionBase
|
||||
{
|
||||
std::string message;
|
||||
void
|
||||
send(std::shared_ptr<Message> msg_type) override
|
||||
send(std::shared_ptr<std::string> msg_type) override
|
||||
{
|
||||
message += std::string(msg_type->data());
|
||||
}
|
||||
MockSession(util::TagDecoratorFactory const& factory) : WsBase(factory)
|
||||
|
||||
void
|
||||
send(std::string&& msg, boost::beast::http::status status = boost::beast::http::status::ok) override
|
||||
{
|
||||
message += msg;
|
||||
}
|
||||
|
||||
MockSession(util::TagDecoratorFactory const& factory) : Server::ConnectionBase(factory, "")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct MockDeadSession : public WsBase
|
||||
struct MockDeadSession : public Server::ConnectionBase
|
||||
{
|
||||
void
|
||||
send(std::shared_ptr<Message> msg_type) override
|
||||
send(std::shared_ptr<std::string> _) override
|
||||
{
|
||||
// err happen, the session should remove from subscribers
|
||||
ec_.assign(2, boost::system::system_category());
|
||||
}
|
||||
MockDeadSession(util::TagDecoratorFactory const& factory) : WsBase(factory)
|
||||
|
||||
void
|
||||
send(std::string&& _, boost::beast::http::status __ = boost::beast::http::status::ok) override
|
||||
{
|
||||
}
|
||||
|
||||
MockDeadSession(util::TagDecoratorFactory const& factory) : Server::ConnectionBase(factory, "")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user