readPacket

open suspend override fun readPacket(size: Int, headerSizeHint: Int): ByteReadPacket

Reads the specified amount of bytes and makes a byte packet from them. Fails if channel has been closed and not enough bytes available. Accepts headerSizeHint to be provided, see BytePacketBuilder.