proxygen
folly::test::MockAsyncTransport Class Reference

#include <MockAsyncTransport.h>

Inheritance diagram for folly::test::MockAsyncTransport:
folly::AsyncTransportWrapper folly::AsyncTransport folly::AsyncReader folly::AsyncWriter folly::DelayedDestruction folly::AsyncSocketBase folly::DelayedDestructionBase

Public Member Functions

 MOCK_METHOD1 (setReadCB, void(ReadCallback *))
 
 MOCK_CONST_METHOD0 (getReadCallback, ReadCallback *())
 
 MOCK_CONST_METHOD0 (getReadCB, ReadCallback *())
 
 MOCK_METHOD4 (write, void(WriteCallback *, const void *, size_t, WriteFlags))
 
 MOCK_METHOD4 (writev, void(WriteCallback *, const iovec *, size_t, WriteFlags))
 
 MOCK_METHOD3 (writeChain, void(WriteCallback *, std::shared_ptr< folly::IOBuf >, WriteFlags))
 
void writeChain (WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&iob, WriteFlags flags=WriteFlags::NONE) override
 
 MOCK_METHOD0 (close, void())
 
 MOCK_METHOD0 (closeNow, void())
 
 MOCK_METHOD0 (closeWithReset, void())
 
 MOCK_METHOD0 (shutdownWrite, void())
 
 MOCK_METHOD0 (shutdownWriteNow, void())
 
 MOCK_CONST_METHOD0 (good, bool())
 
 MOCK_CONST_METHOD0 (readable, bool())
 
 MOCK_CONST_METHOD0 (connecting, bool())
 
 MOCK_CONST_METHOD0 (error, bool())
 
 MOCK_METHOD1 (attachEventBase, void(EventBase *))
 
 MOCK_METHOD0 (detachEventBase, void())
 
 MOCK_CONST_METHOD0 (isDetachable, bool())
 
 MOCK_CONST_METHOD0 (getEventBase, EventBase *())
 
 MOCK_METHOD1 (setSendTimeout, void(uint32_t))
 
 MOCK_CONST_METHOD0 (getSendTimeout, uint32_t())
 
 MOCK_CONST_METHOD1 (getLocalAddress, void(folly::SocketAddress *))
 
 MOCK_CONST_METHOD1 (getPeerAddress, void(folly::SocketAddress *))
 
 MOCK_CONST_METHOD0 (getAppBytesWritten, size_t())
 
 MOCK_CONST_METHOD0 (getRawBytesWritten, size_t())
 
 MOCK_CONST_METHOD0 (getAppBytesReceived, size_t())
 
 MOCK_CONST_METHOD0 (getRawBytesReceived, size_t())
 
 MOCK_CONST_METHOD0 (isEorTrackingEnabled, bool())
 
 MOCK_METHOD1 (setEorTracking, void(bool))
 
 MOCK_CONST_METHOD0 (getWrappedTransport, AsyncTransportWrapper *())
 
 MOCK_CONST_METHOD0 (isReplaySafe, bool())
 
 MOCK_METHOD1 (setReplaySafetyCallback, void(AsyncTransport::ReplaySafetyCallback *))
 
 MOCK_CONST_METHOD0 (getSecurityProtocol, std::string())
 
- Public Member Functions inherited from folly::AsyncTransportWrapper
void setReadCB (ReadCallback *callback) override=0
 
ReadCallbackgetReadCallback () const override=0
 
void write (WriteCallback *callback, const void *buf, size_t bytes, WriteFlags flags=WriteFlags::NONE) override=0
 
void writev (WriteCallback *callback, const iovec *vec, size_t count, WriteFlags flags=WriteFlags::NONE) override=0
 
virtual const AsyncTransportWrappergetWrappedTransport () const
 
template<class T >
const TgetUnderlyingTransport () const
 
template<class T >
TgetUnderlyingTransport ()
 
- Public Member Functions inherited from folly::AsyncTransport
virtual void close ()=0
 
virtual void closeNow ()=0
 
virtual void closeWithReset ()
 
virtual void shutdownWrite ()=0
 
virtual void shutdownWriteNow ()=0
 
virtual bool good () const =0
 
virtual bool readable () const =0
 
virtual bool writable () const
 
virtual bool isPending () const
 
virtual bool connecting () const =0
 
virtual bool error () const =0
 
virtual void attachEventBase (EventBase *eventBase)=0
 
virtual void detachEventBase ()=0
 
virtual bool isDetachable () const =0
 
virtual void setSendTimeout (uint32_t milliseconds)=0
 
virtual uint32_t getSendTimeout () const =0
 
virtual void getLocalAddress (SocketAddress *address) const =0
 
SocketAddress getLocalAddress () const
 
void getAddress (SocketAddress *address) const override
 
virtual void getPeerAddress (SocketAddress *address) const =0
 
SocketAddress getPeerAddress () const
 
virtual ssl::X509UniquePtr getPeerCert () const
 
virtual const X509 * getSelfCert () const
 
virtual const AsyncTransportCertificategetPeerCertificate () const
 
virtual const AsyncTransportCertificategetSelfCertificate () const
 
virtual std::string getApplicationProtocol () const noexcept
 
virtual std::string getSecurityProtocol () const
 
virtual bool isEorTrackingEnabled () const =0
 
virtual void setEorTracking (bool track)=0
 
virtual size_t getAppBytesWritten () const =0
 
virtual size_t getRawBytesWritten () const =0
 
virtual size_t getAppBytesReceived () const =0
 
virtual size_t getRawBytesReceived () const =0
 
virtual bool isReplaySafe () const
 
virtual void setReplaySafetyCallback (ReplaySafetyCallback *callback)
 
- Public Member Functions inherited from folly::DelayedDestruction
virtual void destroy ()
 
bool getDestroyPending () const
 
- Public Member Functions inherited from folly::DelayedDestructionBase
virtual ~DelayedDestructionBase ()=default
 
- Public Member Functions inherited from folly::AsyncSocketBase
virtual EventBasegetEventBase () const =0
 
virtual ~AsyncSocketBase ()=default
 

Additional Inherited Members

- Public Types inherited from folly::AsyncTransportWrapper
using UniquePtr = std::unique_ptr< AsyncTransportWrapper, Destructor >
 
using ReadCallback = AsyncReader::ReadCallback
 
using WriteCallback = AsyncWriter::WriteCallback
 
- Public Types inherited from folly::AsyncTransport
typedef std::unique_ptr< AsyncTransport, DestructorUniquePtr
 
- Protected Member Functions inherited from folly::AsyncTransport
 ~AsyncTransport () override=default
 
- Protected Member Functions inherited from folly::DelayedDestruction
 ~DelayedDestruction () override=default
 
 DelayedDestruction ()
 
- Protected Member Functions inherited from folly::DelayedDestructionBase
 DelayedDestructionBase ()
 
uint32_t getDestructorGuardCount () const
 
- Protected Member Functions inherited from folly::AsyncReader
virtual ~AsyncReader ()=default
 
- Protected Member Functions inherited from folly::AsyncWriter
virtual ~AsyncWriter ()=default
 

Detailed Description

Definition at line 25 of file MockAsyncTransport.h.

Member Function Documentation

folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getReadCallback  ,
ReadCallback () 
)

Referenced by writeChain().

folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getReadCB  ,
ReadCallback () 
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( good  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( readable  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( connecting  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( error  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( isDetachable  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getEventBase  ,
EventBase () 
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getSendTimeout  ,
uint32_t()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getAppBytesWritten  ,
size_t()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getRawBytesWritten  ,
size_t()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getAppBytesReceived  ,
size_t()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getRawBytesReceived  ,
size_t()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( isEorTrackingEnabled  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getWrappedTransport  ,
AsyncTransportWrapper () 
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( isReplaySafe  ,
bool()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD0 ( getSecurityProtocol  ,
std::string()   
)
folly::test::MockAsyncTransport::MOCK_CONST_METHOD1 ( getLocalAddress  ,
void(folly::SocketAddress *)   
)

Referenced by writeChain().

folly::test::MockAsyncTransport::MOCK_CONST_METHOD1 ( getPeerAddress  ,
void(folly::SocketAddress *)   
)
folly::test::MockAsyncTransport::MOCK_METHOD0 ( close  ,
void()   
)
folly::test::MockAsyncTransport::MOCK_METHOD0 ( closeNow  ,
void()   
)
folly::test::MockAsyncTransport::MOCK_METHOD0 ( closeWithReset  ,
void()   
)
folly::test::MockAsyncTransport::MOCK_METHOD0 ( shutdownWrite  ,
void()   
)
folly::test::MockAsyncTransport::MOCK_METHOD0 ( shutdownWriteNow  ,
void()   
)
folly::test::MockAsyncTransport::MOCK_METHOD0 ( detachEventBase  ,
void()   
)
folly::test::MockAsyncTransport::MOCK_METHOD1 ( setReadCB  ,
void(ReadCallback *)   
)
folly::test::MockAsyncTransport::MOCK_METHOD1 ( attachEventBase  ,
void(EventBase *)   
)
folly::test::MockAsyncTransport::MOCK_METHOD1 ( setSendTimeout  ,
void(uint32_t  
)
folly::test::MockAsyncTransport::MOCK_METHOD1 ( setEorTracking  ,
void(bool)   
)
folly::test::MockAsyncTransport::MOCK_METHOD1 ( setReplaySafetyCallback  ,
void(AsyncTransport::ReplaySafetyCallback *)   
)
folly::test::MockAsyncTransport::MOCK_METHOD3 ( writeChain  ,
void(WriteCallback *, std::shared_ptr< folly::IOBuf >, WriteFlags  
)
folly::test::MockAsyncTransport::MOCK_METHOD4 ( write  ,
void(WriteCallback *, const void *, size_t, WriteFlags  
)
folly::test::MockAsyncTransport::MOCK_METHOD4 ( writev  ,
void(WriteCallback *, const iovec *, size_t, WriteFlags  
)
void folly::test::MockAsyncTransport::writeChain ( WriteCallback callback,
std::unique_ptr< folly::IOBuf > &&  buf,
WriteFlags  flags = WriteFlags::NONE 
)
inlineoverridevirtual

If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.

Implements folly::AsyncTransportWrapper.

Definition at line 36 of file MockAsyncTransport.h.

References folly::AsyncTransport::attachEventBase(), folly::AsyncTransport::close(), folly::AsyncTransport::closeNow(), folly::AsyncTransport::closeWithReset(), folly::AsyncTransport::connecting(), folly::AsyncTransport::detachEventBase(), folly::AsyncTransport::error(), folly::AsyncTransport::getAppBytesReceived(), folly::AsyncTransport::getAppBytesWritten(), folly::AsyncSocketBase::getEventBase(), folly::AsyncTransport::getLocalAddress(), folly::AsyncTransport::getPeerAddress(), folly::AsyncTransport::getRawBytesReceived(), folly::AsyncTransport::getRawBytesWritten(), folly::AsyncTransport::getSecurityProtocol(), folly::AsyncTransport::getSendTimeout(), folly::AsyncTransportWrapper::getWrappedTransport(), folly::AsyncTransport::good(), folly::AsyncTransport::isDetachable(), folly::AsyncTransport::isEorTrackingEnabled(), folly::AsyncTransport::isReplaySafe(), MOCK_CONST_METHOD0(), MOCK_CONST_METHOD1(), MOCK_METHOD0(), MOCK_METHOD1(), folly::AsyncTransport::readable(), folly::AsyncTransport::setEorTracking(), folly::AsyncTransport::setReplaySafetyCallback(), folly::AsyncTransport::setSendTimeout(), folly::AsyncTransport::shutdownWrite(), folly::AsyncTransport::shutdownWriteNow(), string, and uint32_t.

39  {
40  writeChain(callback, std::shared_ptr<folly::IOBuf>(iob.release()), flags);
41  }
flags
Definition: http_parser.h:127
void writeChain(WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&iob, WriteFlags flags=WriteFlags::NONE) override

The documentation for this class was generated from the following file: