/// <summary>
 /// Sends a message through the server instance
 /// </summary>
 /// <param name="connectionId">The connection id to which the message shall be sent to</param>
 /// <param name="mockMessage">The message contents that shall be sent</param>
 /// <returns></returns>
 public async Task SendServerMessageAsync(int connectionId, MockMessage mockMessage)
 {
     await Task.Factory.StartNew(() =>
                                 MockMessageServer
                                 .WriteMessage(connectionId, mockMessage)
                                 );
 }
 /// <summary>
 /// Clrears the messaging server instance.
 /// </summary>
 public void ClearServer()
 {
     if (MockMessageServer != null)
     {
         var stopTask = MockMessageServer.StopAsync();
         stopTask.Wait();
     }
 }
 /// <summary>
 /// Clrears the messaging server instance.
 /// </summary>
 public void ClearServer()
 {
     if (MockMessageServer != null)
     {
         MockMessageServer.Stop();
         //var stopTask = MockMessageServer.Stop();
         //stopTask.Wait();
     }
 }
 /// <summary>
 /// Sends a message through the server instance
 /// </summary>
 /// <param name="connectionId">The connection id to which the message shall be sent to</param>
 /// <param name="mockMessage">The message contents that shall be sent</param>
 /// <returns></returns>
 public async Task SendServerMessageAsync(int connectionId, MockMessage mockMessage)
 {
     await MockMessageServer
     .WriteMessageAsync(connectionId, mockMessage)
     .ConfigureAwait(false);
 }
 /// <summary>
 /// Starts the mock message server for listening for new connections
 /// </summary>
 /// <returns></returns>
 public void StartServer()
 {
     MockMessageServer.StartAsync()
     .ConfigureAwait(false);
 }
 /// <summary>
 /// Starts the mock message server for listening for new connections
 /// </summary>
 /// <returns></returns>
 public void StartServer()
 {
     MockMessageServer.Start();
 }