1#ifndef TENDUKE_TEST_FAKES_FAKESOCKET_H
2#define TENDUKE_TEST_FAKES_FAKESOCKET_H
11namespace tenduke {
namespace test {
namespace fakes {
16 std::unique_ptr<Socket>
accept(uint32_t timeoutMs)
override;
18 std::unique_ptr<Socket>
accept()
override;
22 int read(
void *buffer, std::size_t bufferSize)
override;
24 int write(
const void *buffer, std::size_t len)
override;
26 std::uint16_t
getPort()
const override;
34 std::atomic_bool acceptReady;
35 std::deque<tenduke::osa::Socket *> acceptedSockets;
36 std::vector<std::string> writtenData;
OS-independent abstraction of a socket.
Definition Socket.h:14
Definition FakeSocket.h:14
std::uint16_t getPort() const override
Returns port of the socket.
Definition FakeSocket.cpp:51
void setNonBlocking() override
Sets the socket to non-blocking mode.
Definition FakeSocket.cpp:56
int write(const void *buffer, std::size_t len) override
Write bytes to the socket.
Definition FakeSocket.cpp:45
void listen() override
Configures the socket to listen for incoming connections.
Definition FakeSocket.cpp:29
std::unique_ptr< Socket > accept() override
Accepts next connection from listening socket.
Definition FakeSocket.cpp:24
int read(void *buffer, std::size_t bufferSize) override
Reads bytes from the socket.
Definition FakeSocket.cpp:33
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4