/// <summary>
 /// Sends data over the connection asynchronously.
 /// </summary>
 /// <param name="buffer">The buffer to be sent over the connection.</param>
 /// <param name="messageType">TIndicates whether the application is sending a binary or text message.</param>
 /// <param name="endOfMessage">Indicates whether the data in "buffer" is the last part of a message.</param>
 /// <param name="cancellationToken">The token that propagates the notification that operations should be canceled.</param>
 /// <returns>Task.</returns>
 public Task SendAsync(ArraySegment <byte> buffer, ClientMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
 {
     return(_webSocket.SendAsync(
                buffer,
                messageType.ToWebSocketMessageType(),
                endOfMessage,
                cancellationToken));
 }
 public void ToWebSocketMessageType(ClientMessageType messageType, WebSocketMessageType expectedType)
 {
     Assert.AreEqual(expectedType, messageType.ToWebSocketMessageType());
 }