public async Task Initiator_sends_auth_on_channel_activation() { NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Initiator, _remotePublicKey, _logger); handler.ChannelActive(_channelHandlerContext); _service.Received(1).Auth(_remotePublicKey, Arg.Any <EncryptionHandshake>()); await _channelHandlerContext.Received(1).WriteAndFlushAsync(Arg.Is <IByteBuffer>(b => Bytes.AreEqual(b.Array.Slice(0, NetTestVectors.AuthEip8.Length), NetTestVectors.AuthEip8))); }
public async Task Recipient_does_not_send_anything_on_channel_activation() { NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger); handler.ChannelActive(_channelHandlerContext); _service.Received(0).Auth(Arg.Any <NodeId>(), Arg.Any <EncryptionHandshake>()); await _channelHandlerContext.Received(0).WriteAndFlushAsync(Arg.Any <object>()); }
public async Task Initiator_sends_auth_on_channel_activation() { NettyHandshakeHandler handler = new NettyHandshakeHandler(_serializationService, _handshakeService, _session, HandshakeRole.Initiator, _logger, _group); handler.ChannelActive(_channelHandlerContext); _handshakeService.Received(1).Auth(_session.RemoteNodeId, Arg.Any <EncryptionHandshake>()); await _channelHandlerContext.Received(1).WriteAndFlushAsync(Arg.Is <IByteBuffer>(b => Bytes.AreEqual(b.Array.Slice(b.ArrayOffset, NetTestVectors.AuthEip8.Length), NetTestVectors.AuthEip8))); }