code: public void connectSocket() {
  
          synchronized (lock) {
              if (isForegrounded) {
                  if (socketConnection == null) {
                      SocketFactory factory = new SocketFactory(socketURI, new SocketEventDispatcher(listener, new Parser()).setLogger(log), log);
                      socketConnection = new SocketConnectionController(new Handler(Looper.getMainLooper()), dataMgr, factory, listener, new RetryStrategy(60, 60000), log);
                      socketConnection.setProxy(proxyURI);
                      socketConnection.connect();
  
                  } else {
                      socketConnection.connect();
                  }
                  socketConnection.setManageReconnection(true);
              }
              lock.notifyAll();
          }
      }
docs: Create and connect socket.