Closes all connections, deletes all servers, clients, and protocols.

        You should call this method before exiting your test run. This will
        close all the connections and the ports will therefore be available for
        reuse faster.
541785
def reset_rammbock(self):
        
        for client in self._clients:
            client.close()
        for server in self._servers:
            server.close()
        self._init_caches()
979539
def cleanup_tcpsockets(self):
        
        for fileno in self._tcp_client_sockets.keys():
            self.close_tcp_client(fileno)
        for fileno, items in self._tcp_server_sockets.items():
            socket, cb = items
            debug("- _cleanup server socket connection (fd %s)" % fileno)
            self._epoll.unregister(fileno)
            socket.close()
        self._tcp_server_sockets = {}
914662
public void destroy() {
        JmsUtils.closeSession(session);

        if (connection != null) {
            ConnectionFactoryUtils.releaseConnection(connection, endpointConfiguration.getConnectionFactory(), true);
        }
    }
552911
public void close() {
        LOG.info("Begin to shutdown NettyServer");
        if (allChannels != null) {
            new Thread(new Runnable() {

                @Override
                public void run() {
                    try {
                        // await(5, TimeUnit.SECONDS)
                        // sometimes allChannels.close() will block the exit thread
                        allChannels.close().await(1, TimeUnit.SECONDS);
                        LOG.info("Successfully close all channel");
                        factory.releaseExternalResources();
                    } catch (Exception ignored) {
                    }
                    allChannels = null;
                }
            }).start();

            JStormUtils.sleepMs(1000);
        }
        LOG.info("Successfully shutdown NettyServer");
    }
182105
private synchronized void destroyConnLinks() {

        // inUse queue is still open to modification
        // during this time. Returned iterator is a "weakly consistent"
        // I don't believe this has (yet) caused any issues.
        for (Queue<TCPConnLink> queue : this.inUse) {
            try {
                TCPConnLink tcl = queue.poll();
                while (tcl != null) {
                    tcl.close(tcl.getVirtualConnection(), null);
                    tcl = queue.poll();
                }
            } catch (Throwable t) {
                FFDCFilter.processException(t, getClass().getName(), "destroyConnLinks", new Object[] { this });
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Error closing connection: " + t + " " + queue);
                }
            }

        }
    }
447672
function() {
      workers = [];
      netBinding = process.binding('net');
      if (server_socket) {
        netBinding.close(server_socket);
      }
      if (the_server) {
        the_server.watcher.stop();
        the_server = null;
      }
      server_socket = null;
      if (master_server) {
        master_server.close();
      }
      if (master_socket_path) {
        // try to remove the
        try {
          require('fs').unlinkSync(master_socket_path);
        } catch(excp) {
          // do nothing
        }
        master_socket_path = null;
      }
      master_server = null;
      process.removeListener('SIGINT', killer);
      process.removeListener('SIGHUP', killer);
      process.removeListener('SIGTERM', killer);
      process.removeListener('SIGUSR2', respawner); 
      
      try {
        process.stdout.end();
      } catch(exxcpe) {
        // do nothing
      }
    }
774728
def close(self):
        
        self.application.client_leaving(self)

        self.conn.close()
        self.closed = True
1233190
def close(self):
        
        keys = set(self._conns.keys())
        for key in keys:
            self.stop_socket(key)

        self._conns = {}
120701
def close(self):
        
        log.debug("Closing socket connection for %s:%d" % (self.host, self.port))
        if self._sock:
            # Call shutdown to be a good TCP client
            # But expect an error if the socket has already been
            # closed by the server
            try:
                self._sock.shutdown(socket.SHUT_RDWR)
            except socket.error:
                pass

            # Closing the socket should always succeed
            self._sock.close()
            self._sock = None
        else:
            log.debug("No socket found to close!")
1140007
protected void closeServerSocket() {
        // Close server socket, we do not accept new requests anymore.
        // This also terminates the server thread if blocking on socket.accept.
        if (null != serverSocket) {
            try {
                if (!serverSocket.isClosed()) {
                    serverSocket.close();
                    if (log.isTraceEnabled()) {
                        log.trace("Closed server socket " + serverSocket + "/ref="
                                + Integer.toHexString(System.identityHashCode(serverSocket))
                                + " for " + getName());
                    }
                }
            } catch (IOException e) {
                throw new IllegalStateException("Failed to successfully quit server " + getName(), e);
            }
        }
    }
51717
def close(self):
        '''  '''
        cache_key = self._cache_key()
        SSH_CONNECTION_CACHE.pop(cache_key, None)
        SFTP_CONNECTION_CACHE.pop(cache_key, None)
        if self.sftp is not None:
            self.sftp.close()
        self.ssh.close()
1149425
def clear(self):
        
        self._closed = False
        self._ready.clear()
        self._connection.clear()
        self.http.recreate()
344754
public void destroy()
    {
        for (Socket socket : sockets) {
            destroySocket(socket);
        }
        sockets.clear();

        for (Selector selector : selectors) {
            context.close(selector);
        }
        selectors.clear();

        // Only terminate context if we are on the main thread
        if (isMain()) {
            context.term();
        }
    }
344764
public void close() {
        if (connected.compareAndSet(true, false)) {
            // remove handshake flag
            session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
            // clear the delay queue
            queue.clear();
            // whether to attempt a nice close or a forceful one
            if (WebSocketTransport.isNiceClose()) {
                // send a proper ws close
                Packet packet = Packet.build(Constants.CLOSE_MESSAGE_BYTES, MessageType.CLOSE);
                WriteFuture writeFuture = session.write(packet);
                writeFuture.addListener(new IoFutureListener<WriteFuture>() {

                    @Override
                    public void operationComplete(WriteFuture future) {
                        if (future.isWritten()) {
                            log.debug("Close message written");
                            // only set on success for now to skip boolean check later
                            session.setAttribute(Constants.STATUS_CLOSE_WRITTEN, Boolean.TRUE);
                        }
                        future.removeListener(this);
                    }

                });
                // adjust close routine to allow for flushing
                CloseFuture closeFuture = session.closeOnFlush();
                closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                    public void operationComplete(CloseFuture future) {
                        if (future.isClosed()) {
                            log.debug("Connection is closed");
                        } else {
                            log.debug("Connection is not yet closed");
                        }
                        future.removeListener(this);
                    }

                });
            } else {
                // force close
                CloseFuture closeFuture = session.closeNow();
                closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                    public void operationComplete(CloseFuture future) {
                        if (future.isClosed()) {
                            log.debug("Connection is closed");
                        } else {
                            log.debug("Connection is not yet closed");
                        }
                        future.removeListener(this);
                    }

                });
            }
        }
    }
1011942
protected void closeServerSocket() {
        try {
            this.serverSocket.close();
        } catch (IOException ioe) {
            // no need to do anything except log it and dereference
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "IOExeption on ServerSocket.close " + ioe.getMessage());
            }
        }
    }
254600
public void shutdown() {
		synchronized (lock) {
			if (isShutdown) {
				return;
			}

			LOG.info("Shutting down the network environment and its components.");

			// terminate all network connections
			try {
				LOG.debug("Shutting down network connection manager");
				connectionManager.shutdown();
			}
			catch (Throwable t) {
				LOG.warn("Cannot shut down the network connection manager.", t);
			}

			// shutdown all intermediate results
			try {
				LOG.debug("Shutting down intermediate result partition manager");
				resultPartitionManager.shutdown();
			}
			catch (Throwable t) {
				LOG.warn("Cannot shut down the result partition manager.", t);
			}

			// make sure that the global buffer pool re-acquires all buffers
			networkBufferPool.destroyAllBufferPools();

			// destroy the buffer pool
			try {
				networkBufferPool.destroy();
			}
			catch (Throwable t) {
				LOG.warn("Network buffer pool did not shut down properly.", t);
			}

			isShutdown = true;
		}
	}
480503
@Override
    public void destroy() {
        synchronized (channels) {
            isCurrentlyShutingDown = true;
            for (final SynchronizeFXTomcatChannel server : channels.values()) {
                server.shutdown();
            }
            servers.clear();
            channels.clear();
            isCurrentlyShutingDown = false;

        }
    }