diff --git a/CryptoExchange.Net/Sockets/BaseSocket.cs b/CryptoExchange.Net/Sockets/BaseSocket.cs index 9f408c5..e3a06a2 100644 --- a/CryptoExchange.Net/Sockets/BaseSocket.cs +++ b/CryptoExchange.Net/Sockets/BaseSocket.cs @@ -29,6 +29,7 @@ namespace CryptoExchange.Net.Sockets protected IDictionary cookies; protected IDictionary headers; + protected HttpConnectProxy proxy; public int Id { get; } public DateTime? DisconnectTime { get; set; } @@ -194,6 +195,10 @@ namespace CryptoExchange.Net.Sockets EnableAutoSendPing = true, AutoSendPingInterval = 10 }; + + if (proxy != null) + socket.Proxy = proxy; + socket.Security.EnabledSslProtocols = SSLProtocols; socket.Opened += (o, s) => Handle(openHandlers); socket.Closed += (o, s) => Handle(closeHandlers); @@ -253,7 +258,7 @@ namespace CryptoExchange.Net.Sockets public virtual void SetProxy(string host, int port) { - socket.Proxy = IPAddress.TryParse(host, out var address) + proxy = IPAddress.TryParse(host, out var address) ? new HttpConnectProxy(new IPEndPoint(address, port)) : new HttpConnectProxy(new DnsEndPoint(host, port)); }