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 ( ) ; } }
Stop testing job and destroy proxy .