/// <summary> /// Deserialize a message from the stream. /// </summary> /// <param name="networkClient">The network client to deserialize the message from.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The message that was deserialized.</returns> public async Task <IMessage> DeserializeAsync(INetworkClient networkClient, CancellationToken cancellationToken = default(CancellationToken)) { var stream = new ByteArrayStream(await networkClient.ReadDotBlockAsync(cancellationToken).ConfigureAwait(false)); return(new TextMessage(stream)); }