Stop testing job and destroy proxy.

This will stop the current testing job and
destroy the proxy.

@throws PeachApiException
182796
public void sessionTeardown() throws PeachApiException
    {
        stashUnirestProxy();
        
        if(_debug)
            System.out.println(">>sessionTeardown");
        
        try
        {
            HttpResponse<String> ret = null;
            try {
                ret = Unirest
                        .delete(String.format("%s/api/sessions/%s", _api, _jobid))
                        .header(_token_header, _api_token)
                        .asString();
            } catch (UnirestException ex) {
                Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex);
                throw new PeachApiException(
                        String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex);
            }

            if(ret == null)
            {
                throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null);
            }

            if(ret.getStatus() != 200)
            {
                String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s", 
                        ret.getStatus(), ret.getStatusText());

                throw new PeachApiException(errorMsg, null);
            }
        }
        finally
        {
            revertUnirestProxy();
        }
    }
82110
public void close() {
        try {
            // Request BMP to create a new HAR for this Proxy
            HttpDelete shutdownProxyDELETE = new HttpDelete(requestURIBuilder()
                    .setPath(proxyURIPath())
                    .build());

            // Execute request
            CloseableHttpResponse response = HTTPclient.execute(shutdownProxyDELETE);

            // Check request was successful
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode != 200) {
                throw new BMPCUnableToCloseProxyException(String.format(
                        "Invalid HTTP Response when attempting to close " +
                                "Proxy '%d'. Status code: %d",
                        proxyPort, statusCode));
            }
            // Close HTTP Response
            response.close();

            // Close HTTP Client
            HTTPclient.close();
        } catch (Exception e) {
            throw new BMPCUnableToCloseProxyException(e);
        }
    }
181411
async def destroy(self):
        
        app_facade = client.ApplicationFacade.from_connection(self.connection)

        log.debug(
            'Destroying %s', self.name)

        return await app_facade.Destroy(self.name)
968749
public static synchronized void shutdown() {
		if (LOG_APPENDER != null) {
			try {
				LOG_APPENDER.close();
			} catch (Throwable t) {
				LOGGER.error("Exception stopping Stackify Log API service", t);
			}
		}
	}
1201235
function() {
			this._oDialog.close();
			this._oDialog.destroy();
			this._oDialog = null;

			if (this._oAssistantPopover) {
				this._oAssistantPopover.destroy();
				this._oAssistantPopover = null;
			}

			if (this._oDebugPopover) {
				this._oDebugPopover.destroy();
				this._oDebugPopover = null;
			}
		}
403324
public void destroy()
    {
        if (_packet!=null)
            _packet.destroy();
        _packet=null;
        if (_ajpResponse!=null)
            _ajpResponse.destroy();
        _ajpResponse=null;
        _out=null;
    }
1146858
public void stop() throws Throwable
   {
      Context context = new InitialContext();

      context.unbind(JNDI_NAME);

      context.close();
   }
1041195
def stop(self):
        
        for component in self.components:
            component.close()
            self.log('Stopping component - {}', component.__class__.__name__)

        for controller in self.controllers.values():
            controller.close()
            self.log('Stopping controller - {}', controller.__class__.__name__)

        atexit.unregister(self.stop)
764232
public function stop()
    {
        if (null === $this->sessionId) {
            throw new Exception("Session not started");
        }

        $this->doExecute('testComplete');
        $this->sessionId = null;
    }
325801
@Override
  public void abortJob(JobContext context, JobStatus.State state)
  throws IOException {
    cleanupJob(context);
  }
588305
public synchronized void destroy()
    {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) 
            logger.logp(Level.FINE, CLASS_NAME,"destroy", "entry");

        /*destroying=true;
        
        if (nServicing>0){
        	try {
				this.wait();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				
			}
        }*/
    	
        super.destroy();

        //parent.removeSubContainer(name);    	//PK37449
    	this.requestMapper = null;
    	this.config = null;
    	this.webApp = null;  // PK25527
        
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) 
        	logger.exiting(CLASS_NAME, "destroy");													//569469
    }
1214771
public void destroy() {

		if (bundlesHandler != null) {
			ThreadLocalJawrContext.setInterruptProcessingBundle(true);
		}

		// Stop the config change listener.
		if (null != this.configChangeListenerThread) {
			configChangeListenerThread.stopPolling();
			try {
				configChangeListenerThread.interrupt();
				Thread.sleep(200);
			} catch (InterruptedException e) {
				// Nothing to do
			}
		}
		if (watcher != null) {
			watcher.stopWatching();
			try {
				watcher.interrupt();
				Thread.sleep(200);
			} catch (InterruptedException e) {
				// Nothing to do
			}
		}

		JmxUtils.unregisterJMXBean(servletContext, resourceType,
				jawrConfig.getProperty(JawrConstant.JAWR_JMX_MBEAN_PREFIX));

		ThreadLocalJawrContext.reset();
	}
373757
public void stop(BundleContext context) throws Exception {
        ClassServiceUtility.log(context, LogService.LOG_INFO, "Stopping " + this.getClass().getName() + " Bundle");
    	if (this.shutdownService(service, context))
    		service = null;
        // Unregisters automatically
        this.context = null;
    }
1125763
void destroy() {
        for (DistributedObjectFuture future : proxies.values()) {
            if (!future.isSetAndInitialized()) {
                continue;
            }

            DistributedObject distributedObject = extractDistributedObject(future);
            invalidate(distributedObject);
        }
        proxies.clear();
    }
1129885
public void stop() throws Exception {

		if( this.nazgulAgentFactory != null ) {
			for( ComponentInstance nazgul : this.nazgulAgentFactory.getInstances())
				deleteIPojoInstance( nazgul );
		}

		if( this.standardAgentFactory != null ) {
			for( ComponentInstance agent : this.standardAgentFactory.getInstances())
				deleteIPojoInstance( agent );
		}
	}
573046
static synchronized void destroy() {
        if (debuggable()) {
            hasInit = false;
            LogisticsCenter.suspend();
            logger.info(Consts.TAG, "ARouter destroy success!");
        } else {
            logger.error(Consts.TAG, "Destroy can be used in debug mode only!");
        }
    }
935707
public synchronized void stop() throws DatastoreEmulatorException {
    // We intentionally don't check the internal state. If people want to try and stop the server
    // multiple times that's fine.
    stopEmulatorInternal();
    if (state != State.STOPPED) {
      state = State.STOPPED;
      if (projectDirectory != null) {
        try {
          Process process =
              new ProcessBuilder("rm", "-r", projectDirectory.getAbsolutePath()).start();
          if (process.waitFor() != 0) {
            throw new IOException(
                "Temporary project directory deletion exited with " + process.exitValue());
          }
        } catch (IOException e) {
          throw new IllegalStateException("Could not delete temporary project directory", e);
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
          throw new IllegalStateException("Could not delete temporary project directory", e);
        }
      }
    }
  }