code: public void disconnectSocket() {
          synchronized (lock) {
              if (socketConnection != null) {
                  socketConnection.setManageReconnection(false);
                  socketConnection.disconnect();
              }
              lock.notifyAll();
          }
      }
docs: Disconnect socket.