public static ITcpConnection CreateConnectingConnection(Guid connectionId, IPEndPoint remoteEndPoint, string targetHost, bool validateServer, TcpClientConnector connector, TimeSpan connectionTimeout, Action <ITcpConnection> onConnectionEstablished, Action <ITcpConnection, SocketError> onConnectionFailed, bool verbose) { var connection = new TcpConnectionSsl(connectionId, remoteEndPoint, verbose); // ReSharper disable ImplicitlyCapturedClosure connector.InitConnect(remoteEndPoint, (_, socket) => { connection.InitClientSocket(socket, targetHost, validateServer, verbose); if (onConnectionEstablished != null) { onConnectionEstablished(connection); } }, (_, socketError) => { if (onConnectionFailed != null) { onConnectionFailed(connection, socketError); } }, connection, connectionTimeout); // ReSharper restore ImplicitlyCapturedClosure return(connection); }
public static ITcpConnection CreateConnectingConnection(Guid connectionId, string targetHost, IPEndPoint remoteEndPoint, Func <X509Certificate, X509Chain, SslPolicyErrors, ValueTuple <bool, string> > serverCertValidator, Func <X509CertificateCollection> clientCertificatesSelector, TcpClientConnector connector, TimeSpan connectionTimeout, Action <ITcpConnection> onConnectionEstablished, Action <ITcpConnection, SocketError> onConnectionFailed, bool verbose) { var connection = new TcpConnectionSsl(connectionId, remoteEndPoint, verbose); // ReSharper disable ImplicitlyCapturedClosure connector.InitConnect(remoteEndPoint, (socket) => { connection.InitClientSocket(socket); }, (_, socket) => { connection.InitSslStream(targetHost, serverCertValidator, clientCertificatesSelector, verbose); if (onConnectionEstablished != null) { onConnectionEstablished(connection); } }, (_, socketError) => { if (onConnectionFailed != null) { onConnectionFailed(connection, socketError); } }, connection, connectionTimeout); // ReSharper restore ImplicitlyCapturedClosure return(connection); }
public static ITcpConnection CreateConnectingConnection(Guid connectionId, IPEndPoint remoteEndPoint, string targetHost, bool validateServer, TcpClientConnector connector, TimeSpan connectionTimeout, Action<ITcpConnection> onConnectionEstablished, Action<ITcpConnection, SocketError> onConnectionFailed, bool verbose) { var connection = new TcpConnectionSsl(connectionId, remoteEndPoint, verbose); // ReSharper disable ImplicitlyCapturedClosure connector.InitConnect(remoteEndPoint, (_, socket) => { connection.InitClientSocket(socket, targetHost, validateServer, verbose); if (onConnectionEstablished != null) onConnectionEstablished(connection); }, (_, socketError) => { if (onConnectionFailed != null) onConnectionFailed(connection, socketError); }, connection, connectionTimeout); // ReSharper restore ImplicitlyCapturedClosure return connection; }
public static ITcpConnection CreateClientFromSocket(Guid connectionId, IPEndPoint remoteEndPoint, Socket socket, string targetHost, bool validateServer, bool verbose) { var connection = new TcpConnectionSsl(connectionId, remoteEndPoint, verbose); connection.InitClientSocket(socket, targetHost, validateServer, verbose); return connection; }
public static ITcpConnection CreateClientFromSocket(Guid connectionId, IPEndPoint remoteEndPoint, Socket socket, string targetHost, bool validateServer, bool verbose) { var connection = new TcpConnectionSsl(connectionId, remoteEndPoint, verbose); connection.InitClientSocket(socket, targetHost, validateServer, verbose); return(connection); }
public static ITcpConnection CreateClientFromSocket(Guid connectionId, IPEndPoint remoteEndPoint, Socket socket, string targetHost, bool validateServer, X509CertificateCollection clientCertificates, bool verbose) { var connection = new TcpConnectionSsl(connectionId, remoteEndPoint, verbose); connection.InitClientSocket(socket); connection.InitSslStream(targetHost, validateServer, clientCertificates, verbose); return(connection); }