Inheritance: Microsoft.AspNet.SignalR.WebSockets.WebSocketHandler
 public WebSocketTransport(IHttpClient client)
     : base(client, "webSockets")
 {
     _disconnectToken = CancellationToken.None;
     ReconnectDelay = TimeSpan.FromSeconds(2);
     _webSocketHandler = new ClientWebSocketHandler(this);
 }
        public void OnCloseCallsIntoWebSocketTransportOnClose()
        {
            var mockWebSocketTransport = new Mock<WebSocketTransport>();

            var webSocketHandler = new ClientWebSocketHandler(mockWebSocketTransport.Object);
            webSocketHandler.OnClose();

            mockWebSocketTransport.Verify(p => p.OnClose(), Times.Once());
        }
        public void OnCloseCallsIntoWebSocketTransportOnClose()
        {
            var mockWebSocketTransport = new Mock <WebSocketTransport>();

            var webSocketHandler = new ClientWebSocketHandler(mockWebSocketTransport.Object);

            webSocketHandler.OnClose();

            mockWebSocketTransport.Verify(p => p.OnClose(), Times.Once());
        }
        public void OnErrorCallsIntoWebSocketTransportOnErrorAndPassesException()
        {
            var exception = new Exception();
            var mockWebSocketTransport = new Mock<WebSocketTransport>();

            var webSocketHandler =
                new ClientWebSocketHandler(mockWebSocketTransport.Object) { Error = exception };

            webSocketHandler.OnError();

            mockWebSocketTransport.Verify(p => p.OnError(exception), Times.Once());
        }
        public void OnErrorCallsIntoWebSocketTransportOnErrorAndPassesException()
        {
            var exception = new Exception();
            var mockWebSocketTransport = new Mock <WebSocketTransport>();

            var webSocketHandler =
                new ClientWebSocketHandler(mockWebSocketTransport.Object)
            {
                Error = exception
            };

            webSocketHandler.OnError();

            mockWebSocketTransport.Verify(p => p.OnError(exception), Times.Once());
        }
 // intended for testing
 internal WebSocketTransport(ClientWebSocketHandler webSocketHandler)
     : this()
 {
     _webSocketHandler = webSocketHandler;
 }