diff --git a/app/lib/proxy.ts b/app/lib/proxy.ts
index 3627314db06cbfb04aa7a13ac061ab983e78d050..8c7016890586a9e6fe3966958d5d9078250b7fb5 100644
--- a/app/lib/proxy.ts
+++ b/app/lib/proxy.ts
@@ -1,8 +1,5 @@
 const SocksProxyAgent = require('socks-proxy-agent');
 
-const constants = require('./constants');
-const WS2PConstants = require('../modules/ws2p/lib/constants');
-
 const DEFAULT_PROXY_TIMEOUT:number = 30000
 const TOR_PROXY_TIMEOUT:number = 60000
 const HTTP_ENDPOINT_ONION_REGEX = new RegExp('(?:https?:\/\/)?(?:www)?(\S*?\.onion)(\/[-\w]*)*')
@@ -21,25 +18,32 @@ export interface ProxyConf {
 }
 
 export class Proxy {
-  public agent: any
+  private agent: any
   private url:string
 
-  constructor(proxy:string, type:string = "socks", public timeout:number = DEFAULT_PROXY_TIMEOUT) {
+  constructor(proxy:string, type:string = "socks", private timeout:number = DEFAULT_PROXY_TIMEOUT) {
     if (type === "socks") {
-        this.agent = SocksProxyAgent("socks://"+proxy)
-        this.url = "socks://"+proxy
+      this.agent = SocksProxyAgent("socks://"+proxy)
+      this.url = "socks://"+proxy
     }
     else {
-        this.url = ""
-        this.agent = undefined
+      this.agent = undefined  
+      this.url = ""
     }
-    this.timeout = timeout
+  }
+
+  getAgent() {
+    return this.agent;
   }
 
   getUrl() {
     return this.url;
   }
 
+  getTimeout() {
+    return this.timeout;
+  }
+
   static defaultConf():ProxyConf {
     return {
         proxySocksAddress: undefined,
diff --git a/app/modules/ws2p/lib/WS2PConnection.ts b/app/modules/ws2p/lib/WS2PConnection.ts
index 06de3fc44f3230e81f7872ec7022695ad0c1d818..7d0b96a020aa6c521228f91d4a27d47be65eddfb 100644
--- a/app/modules/ws2p/lib/WS2PConnection.ts
+++ b/app/modules/ws2p/lib/WS2PConnection.ts
@@ -279,11 +279,11 @@ export class WS2PConnection {
     expectedPub:string = "") {
       if (proxy !== undefined) {
         options = {
-          connectionTimeout: proxy.timeout,
-          requestTimeout: proxy.timeout
+          connectionTimeout: proxy.getTimeout(),
+          requestTimeout: proxy.getTimeout()
         }
       }
-      const websocket = (proxy !== undefined) ? new ws(address, { agent: proxy.agent }):new ws(address)
+      const websocket = (proxy !== undefined) ? new ws(address, { agent: proxy.getAgent() }):new ws(address)
     const onWsOpened:Promise<void> = new Promise(res => {
       websocket.on('open', () => res())
     })