Close the websocket with a failure.
329781
@Override
  public void fail(Throwable exn)
  {
    log.log(Level.WARNING, exn.toString(), exn);
  }
97575
function (session) {

        if (session.websocket.server) session.websocket.server.close();

        session.proxy.close(function (err) {
            console.error('Error: ' + err);
        });
    }
380281
public void close() throws IOException {
		Throwable throwable = null;

		try {
			socket.close();
			sender.close();
			receiver.close();
		} catch (Throwable t) {
			throwable = t;
		}

		try {
			destroyProcess(process);
		} catch (Throwable t) {
			throwable = ExceptionUtils.firstOrSuppressed(t, throwable);
		}

		ShutdownHookUtil.removeShutdownHook(shutdownThread, getClass().getSimpleName(), LOG);

		ExceptionUtils.tryRethrowIOException(throwable);
	}
494931
def on_close(self):
        '''
        
        '''

        if self.id in self.funcserver.websocks:
            self.funcserver.websocks[self.id] = None
            ioloop = tornado.ioloop.IOLoop.instance()
            ioloop.add_callback(lambda: self.funcserver.websocks.pop(self.id, None))

        psession = self.funcserver.pysessions.get(self.pysession_id, None)
        if psession:
            psession['socks'].remove(self.id)
            if not psession['socks']:
                del self.funcserver.pysessions[self.pysession_id]
630710
protected void closeChannel ()
    {
        if (_channel != null) {
            log.debug("Closing socket channel.");

            try {
                _channel.close();
            } catch (IOException ioe) {
                log.warning("Error closing failed socket: " + ioe);
            }
            _channel = null;

            // clear these out because they are probably large and in charge
            _oin = null;
            _oout = null;
        }
    }
914303
function socketOnClose() {
  const websocket = this[kWebSocket];

  this.removeListener('close', socketOnClose);
  this.removeListener('end', socketOnEnd);

  websocket.readyState = WebSocket.CLOSING;

  //
  // The close frame might not have been received or the `'end'` event emitted,
  // for example, if the socket was destroyed due to an error. Ensure that the
  // `receiver` stream is closed after writing any remaining buffered data to
  // it. If the readable side of the socket is in flowing mode then there is no
  // buffered data as everything has been already written and `readable.read()`
  // will return `null`. If instead, the socket is paused, any possible buffered
  // data will be read as a single chunk and emitted synchronously in a single
  // `'data'` event.
  //
  websocket._socket.read();
  websocket._receiver.end();

  this.removeListener('data', socketOnData);
  this[kWebSocket] = undefined;

  clearTimeout(websocket._closeTimer);

  if (
    websocket._receiver._writableState.finished ||
    websocket._receiver._writableState.errorEmitted
  ) {
    websocket.emitClose();
  } else {
    websocket._receiver.on('error', receiverOnFinish);
    websocket._receiver.on('finish', receiverOnFinish);
  }
}
335850
public void disconnect() {
        if (readyState == ReadyState.OPEN) {
            // readyState should be set to ReadyState.CLOSED ONLY AFTER the
            // the WebSocket has been successfully closed in
            // socketClosedHandler().
            this.closeConnection(0, "", 0, 0, null, null);
        } else if (readyState == ReadyState.CONNECTING) {
            socketClosedHandler();
        }
    }
282233
function close() {
        $this->_error_log('closing socket ' . $this->sock);
        $this->_connection_closed = true;
        fclose($this->sock);
    }
308951
async def stop(self):
        """"""
        self._shutdown = True

        if self.wsck:
            _LOGGER.info('Closing Emby server websocket.')
            await self.wsck.close()
            self.wsck = None

        if self._own_loop:
            _LOGGER.info("Shutting down Emby server loop...")
            self._event_loop.call_soon_threadsafe(self._event_loop.stop)
213084
def close(self):
        
        try:
            self.connection.close()
            self.connection = None
        except Exception:
            if not self.fail_silently:
                raise
281310
public void close()
    throws IOException
  {
    ServerSocketChannel ss = _ss;
    _ss = ss;

    if (ss != null) {
      try {
        ss.close();
      } catch (Exception e) {
      }
    }
  }
85256
def shutdown(self):
        """"""
        if self.OPEN:
            self.OPEN = False
            scoop.SHUTDOWN_REQUESTED = True
            self.socket.send(b"SHUTDOWN")
            self.socket.close()
            self.infoSocket.close()
            time.sleep(0.3)
317024
public void terminate()
    {
        try
        {
            in.close();
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception);
        }
        try
        {
            out.close();
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception);
        }
        try
        {
            socket.close();
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception);
        }
        state = StateConnection.DISCONNECTED;
    }
1147902
def close(self):
        """"""

        try:
            self.sock.shutdown(socket.SHUT_RDWR)
            self.sock.close()
        except socket.error:
            pass
1344213
def close_socket(self):
        ''''''
        log.debug("Closing socket")
        if self.sock:
            try:
                self.sock.close()
            except:
                pass

            self.sock = None
811146
def stop(self, timeout_s=None):
    """"""
    self._live = False
    try:
      self._sock.shutdown(socket.SHUT_RDWR)
      self._sock.close()
    except socket.error:
      pass
    self.join(timeout_s)
751789
def close(self):
        
        if self.device is not None:
            self.device.shutdown(socket.SHUT_RDWR)
            self.device.close()