MemoryTransport class final
An in-memory transport used for tests and as the basis for mock brokers.
- Implemented types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
incoming
→ Stream<
Uint8List> -
Chunks of bytes received from the peer.
no setteroverride
- isClosed → bool
-
Whether close was called and the transport cannot be reused.
no setter
- isConnected → bool
-
Whether the transport is currently connected.
no setteroverride
-
outgoing
→ List<
Uint8List> -
Bytes written by the client (what the peer would receive).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Uint8List data) → void -
Queues
datafor sending to the peer.override -
close(
) → Future< void> -
Closes the transport.
override
-
connect(
) → Future< void> -
Establishes the underlying connection.
override
-
flush(
) → Future< void> -
Flushes any buffered outbound data.
override
-
inject(
Uint8List data) → void - Simulates bytes arriving from the peer.
-
injectError(
Object error) → void -
Simulates a connection failure by emitting
errorto the incoming stream, as a real transport would on socket error. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
takeOutgoing(
) → List< Uint8List> - Returns and clears all queued outgoing chunks.
-
takeOutgoingBytes(
) → Uint8List - Concatenates all queued outgoing chunks into a single buffer.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited