public SslCommunicationInfo(
     IPausableFtpService transmitterService,
     IPausableFtpService receiverService,
     Stream sslStream)
 {
     TransmitterService = transmitterService;
     ReceiverService    = receiverService;
     SslStream          = sslStream;
 }
        internal static async Task <Func <Task> > WrapPauseAsync(this IPausableFtpService service, CancellationToken cancellationToken)
        {
            if (service.Status == FtpServiceStatus.Paused)
            {
                return(() => Task.CompletedTask);
            }

            await service.PauseAsync(cancellationToken)
            .ConfigureAwait(false);

            return(() => service.ContinueAsync(cancellationToken));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PassThroughConnectionAdapter"/> class.
 /// </summary>
 /// <param name="socketPipe">The pipe for the socket.</param>
 /// <param name="connectionPipe">The pipe for the <see cref="IFtpConnection"/>.</param>
 /// <param name="connectionClosed">A cancellation token for a closed connection.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 public PassThroughConnectionAdapter(
     [NotNull] IDuplexPipe socketPipe,
     [NotNull] IDuplexPipe connectionPipe,
     CancellationToken connectionClosed,
     [CanBeNull] ILoggerFactory loggerFactory = null)
 {
     _receiverService = new NonClosingNetworkPassThrough(
         socketPipe.Input,
         connectionPipe.Output,
         connectionClosed,
         loggerFactory?.CreateLogger(typeof(PassThroughConnectionAdapter).FullName + ":Receiver"));
     _transmitService = new NonClosingNetworkPassThrough(
         connectionPipe.Input,
         socketPipe.Output,
         connectionClosed,
         loggerFactory?.CreateLogger(typeof(PassThroughConnectionAdapter).FullName + ":Transmitter"));
 }