Disconnect from the remote host. No more messages can be sent after this
method has been called.

@param reason
@param disconnectReason
, description
@throws IOException
493198
public void disconnect(int reason, String disconnectReason) {

		ByteArrayWriter baw = new ByteArrayWriter();

		try {
			this.disconnectReason = disconnectReason;

			baw.write(SSH_MSG_DISCONNECT);
			baw.writeInt(reason);
			baw.writeString(disconnectReason);
			baw.writeString("");

			Log.info(this, "Sending SSH_MSG_DISCONNECT ["
					+ disconnectReason + "]");

			sendMessage(baw.toByteArray(), true);

		} catch (Throwable t) {
		} finally {
			try {
				baw.close();
			} catch (IOException e) {
			}
			internalDisconnect();
		}
	}
669014
@Override
    public void quit(String reason) {
        if (!connected) {
            throw new NotConnectedException();
        }

        Message quit = new Message(MessageType.QUIT, reason);
        ChannelFuture future = connection.send(quit);

        /* Wait for message to be sent and then close the underlying connection */
        future.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                connection.close();
            }
        });
    }
1371522
public synchronized void disconnect() {
    if (mConnected) {
      Preconditions.checkNotNull(mChannel, PreconditionMessage.CHANNEL_NULL_WHEN_CONNECTED);
      LOG.debug("Disconnecting from the {} @ {}", getServiceName(), mAddress);
      beforeDisconnect();
      mChannel.shutdown();
      mConnected = false;
      afterDisconnect();
    }
  }
1186012
@Override
    public void disconnect()
    {
        network.disconnect();
        for (final L listener : listeners)
        {
            network.removeListener(listener);
        }
        listeners.clear();
    }
175576
public void disconnect(LDAPConnection ldapConnection) {

        // Attempt disconnect
        try {
            ldapConnection.disconnect();
        }

        // Warn if disconnect unexpectedly fails
        catch (LDAPException e) {
            logger.warn("Unable to disconnect from LDAP server: {}", e.getMessage());
            logger.debug("LDAP disconnect failed.", e);
        }

    }
1282907
def disconnect(self, device):
        """"""
        self.device.ctrl.sendcontrol('d')
        self.device.ctrl.send("c.")
        self.log("CONSOLE SERVER disconnect")
        try:
            self.device.ctrl.send(chr(4))
        except OSError:
            self.log("Protocol already disconnected")
208782
private void error(ErrorReason error)
    {
        if (options.rawSocket) {
            //  For raw sockets, send a final 0-length message to the application
            //  so that it knows the peer has been disconnected.
            Msg terminator = new Msg();
            processMsg.apply(terminator);
        }
        assert (session != null);
        socket.eventDisconnected(endpoint, fd);
        session.flush();
        session.engineError(error);
        unplug();
        destroy();
    }
9121
def closed(self, reason):
        """"""
        self.client.remove_connection(self)
        self.protocol.connection_lost(reason)
        if not isinstance(reason, ConnectionClosed):
            logger.warn("connection closed, reason {}".format(reason))
        else:
            logger.info("connection closed")
1336785
protected void disconnect() {
		if (client != null) {
			try {
				client.stop();
			} catch (Exception ignored) {
			}
		}
		synchronized (publishers) {
			for (TopicPublisher publisher : publishers.values()) {
				try {
					publisher.close();
				} catch (Exception ignored) {
				}
			}
			publishers.clear();
		}
		synchronized (subscribers) {
			for (TopicSubscriber subscriber : subscribers.values()) {
				try {
					subscriber.close();
				} catch (Exception ignored) {
				}
			}
			subscribers.clear();
		}
		if (session != null) {
			try {
				session.close();
			} catch (Exception ignored) {
			}
			session = null;
		}
		if (client != null) {
			try {
				client.close();
			} catch (Exception ignored) {
			}
			client = null;
		}
	}
111981
protected void triggerSessionClosed(String reason) {
        //        for (ContentNegotiator contentNegotiator : contentNegotiators) {
        //
        //            contentNegotiator.stopJingleMediaSession();
        //
        //            for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
        //                candidate.removeCandidateEcho();
        //        }

        List<JingleListener> listeners = getListenersList();
        for (JingleListener li : listeners) {
            if (li instanceof JingleSessionListener) {
                JingleSessionListener sli = (JingleSessionListener) li;
                sli.sessionClosed(reason, this);
            }
        }
        close();
    }
438580
public void disconnect() {

		if (!connected) {
			return;
		}

		try {
			socket.close();
		} catch (IOException e) {
			LOG.debug("I/O exception when closing socket", e);
		}

		this.connected = false;
	}
1028528
public void disconnect() {
        Presence unavailablePresence = null;
        if (isAuthenticated()) {
            unavailablePresence = new Presence(Presence.Type.unavailable);
        }
        try {
            disconnect(unavailablePresence);
        }
        catch (NotConnectedException e) {
            LOGGER.log(Level.FINEST, "Connection is already disconnected", e);
        }
    }
626113
def Disconnect(self, reason=None, isDead=True):
        """"""
        self.disconnecting = True
        self.expect_verack_next = False
        if reason:
            logger.debug(f"Disconnecting with reason: {reason}")
        self.stop_block_loop()
        self.stop_header_loop()
        self.stop_peerinfo_loop()
        if isDead:
            self.leader.AddDeadAddress(self.address, reason=f"{self.prefix} Forced disconnect by us")

        self.leader.forced_disconnect_by_us += 1

        self.disconnect_deferred = defer.Deferred()
        self.disconnect_deferred.debug = True
        # force disconnection without waiting on the other side
        # calling later to give func caller time to add callbacks to the deferred
        reactor.callLater(1, self.transport.abortConnection)
        return self.disconnect_deferred
460227
function disconnect() {
  var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
  var cb = arguments.length <= 1 || arguments[1] === undefined ? undefined : arguments[1];

  console.log('Disconnecting client: ' + clientId);
  stopPub = true;
  client.end(force, cb);
}
797245
void removeClient(ClientSocket client)
    {
        if (client != null)
        {
            toRemove.add(client);
            client.terminate();
            clientsNumber--;
            willRemove = true;
            Verbose.info(SERVER, client.getName(), " disconnected");
        }
    }
422656
@Override
  public void close(WebSocketClose reason, String text)
  {
    Objects.requireNonNull(reason);

    if (_state.isClosed()) {
      return;
    }

    _state = _state.closeSelf();

    _frameOut.close(reason, text);

    if (_state.isClosed()) {
      disconnect();
    }
  }
1363311
protected void reconnect(Throwable cause) {
		if (cause != null) {
			String msg = cause.getMessage();
			if (msg == null || msg.isEmpty()) {
				msg = "Unable to connect to JMS server!";
			} else if (!msg.endsWith("!") && !msg.endsWith(".")) {
				msg += "!";
			}
			logger.warn(msg);
		}
		disconnect();
		logger.info("Trying to reconnect...");
		scheduler.schedule(this::connect, 5, TimeUnit.SECONDS);
	}