/// <summary>
        /// Establishes a socket connection to the specified host and port.
        /// </summary>
        /// <param name="host">The host name of the server to connect to.</param>
        /// <param name="port">The port to connect to.</param>
        /// <exception cref="SshOperationTimeoutException">The connection failed to establish within the configured <see cref="Renci.SshNet.ConnectionInfo.Timeout"/>.</exception>
        /// <exception cref="SocketException">An error occurred trying to establish the connection.</exception>
        partial void SocketConnect(string host, int port)
        {
            const int socketBufferSize = 2 * MaximumSshPacketSize;

            var timeout = ConnectionInfo.Timeout;
            var ep      = new EndpointPair(null, string.Empty, new HostName(host), port.ToString());

            _socket = new SocketWrapper();
            _socket.Control.NoDelay = true;
            _socket.Control.OutboundBufferSizeInBytes = socketBufferSize;

            Log(string.Format("Initiating connect to '{0}:{1}'.", ConnectionInfo.Host, ConnectionInfo.Port));

            var connectResult = _socket.ConnectAsync(ep).AsTask();

            if (Task.WhenAny(connectResult, Task.Delay(timeout)).Result != connectResult)
            {
                throw new SshOperationTimeoutException(string.Format(CultureInfo.InvariantCulture,
                                                                     "Connection failed to establish within {0:F0} milliseconds.", timeout.TotalMilliseconds));
            }
        }