public async void ShouldThrowIOExceptionIfFailedToReadOnHandshakeAsync()
            {
                var bufferSettings = new BufferSettings(Config.Default);

                var connMock = new Mock <ITcpSocketClient>();

                TcpSocketClientTestSetup.CreateReadStreamMock(connMock);
                TcpSocketClientTestSetup.CreateWriteStreamMock(connMock);

                var client = new SocketClient(FakeUri, null, bufferSettings, socketClient: connMock.Object);

                var ex = await Record.ExceptionAsync(() => client.ConnectAsync(new Dictionary <string, string>()));

                ex.Should().NotBeNull().And.BeOfType <IOException>();
            }
            public async Task ShouldConnectServerAsync()
            {
                var bufferSettings = new BufferSettings(Config.DefaultConfig);

                var connMock = new Mock <ITcpSocketClient>();

                TcpSocketClientTestSetup.CreateReadStreamMock(connMock, new byte[] { 0, 0, 0, 1 });
                TcpSocketClientTestSetup.CreateWriteStreamMock(connMock);

                var client = new SocketClient(FakeUri, null, bufferSettings, socketClient: connMock.Object);

                await client.StartAsync();

                // Then
                connMock.Verify(x => x.ConnectAsync(FakeUri), Times.Once);
            }
            public async Task ShouldConnectServerAsync()
            {
                var bufferSettings = new BufferSettings(Config.Default);
                var version        = new BoltProtocolVersion(4, 1);
                var connMock       = new Mock <ITcpSocketClient>();

                TcpSocketClientTestSetup.CreateReadStreamMock(connMock, PackStreamBitConverter.GetBytes(version.PackToInt()));
                TcpSocketClientTestSetup.CreateWriteStreamMock(connMock);

                PackStreamBitConverter.GetBytes((int)0x14);

                var client = new SocketClient(FakeUri, null, bufferSettings, socketClient: connMock.Object);

                await client.ConnectAsync(new Dictionary <string, string>());

                // Then
                connMock.Verify(x => x.ConnectAsync(FakeUri), Times.Once);
            }