readInbound(as:)

If available, this method reads one element of type T out of the EmbeddedChannel’s inbound buffer. If the first element was of a different type than requested, EmbeddedChannel.WrongTypeError will be thrown, if there are no elements in the outbound buffer, nil will be returned.

Embedded.swift:910
func readInbound<T>(as type: T.Type = T.self) throws -> T?

Data hits the EmbeddedChannel’s inbound buffer when data was send through the pipeline using fireChannelRead and then travelled the ChannelPipeline all the way too the back. For data to hit the inbound buffer, the last ChannelHandler must have send the event either explicitly (by calling ChannelHandlerContext.fireChannelRead) or implicitly by not implementing channelRead.