EmbeddedChannel

EmbeddedChannel is a Channel implementation that does neither any actual IO nor has a proper eventing mechanism. The prime use-case for EmbeddedChannel is in unit tests when you want to feed the inbound events and check the outbound events manually.

Embedded.swift:669
final class EmbeddedChannel

Please remember to call finish() when you are no longer using this EmbeddedChannel.

To feed events through an EmbeddedChannel’s ChannelPipeline use EmbeddedChannel.writeInbound which accepts data of any type. It will then forward that data through the ChannelPipeline and the subsequent ChannelInboundHandler will receive it through the usual channelRead event. The user is responsible for making sure the first ChannelInboundHandler expects data of that type.

EmbeddedChannel automatically collects arriving outbound data and makes it available one-by-one through readOutbound.