diff --git a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs index 2da863d..dfce57c 100644 --- a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs +++ b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs @@ -212,9 +212,12 @@ namespace CryptoExchange.Net.Sockets /// public virtual void SetProxy(ApiProxy proxy) { - _socket.Options.Proxy = new WebProxy(proxy.Host, proxy.Port); - if (proxy.Login != null) - _socket.Options.Proxy.Credentials = new NetworkCredential(proxy.Login, proxy.Password); + + _socket.Options.Proxy = new WebProxy + { + Address = new Uri($"{proxy.Host}:{proxy.Port}"), + Credentials = proxy.Password == null ? null : new NetworkCredential(proxy.Login, proxy.Password) + }; } ///