public static async Task <byte[]> ToByteArrayAsync(IHandshakeResponse r)
        {
            using (var stream = new MemoryStream())
            {
                stream.WriteByte((byte)r.ResponseCode);

                await stream.WriteUTF8Async(r.Message, SizeLength.INT);

                await stream.WriteAsync(r.RequestData);

                return(stream.ToArray());
            }
        }
 public static bool Equals(IHandshakeResponse x, IHandshakeResponse y)
 {
     return(x.Message == y.Message &&
            x.ResponseCode == y.ResponseCode &&
            x.RequestData.EqualsContent(y.RequestData));
 }