code: public void close() throws IOException {
          if ( session != null && session.isConnected() ) {
              session.disconnect();
          }
          session = null;
  
          // unnecessary, but seems right to undo what we did
          for ( Tunnel tunnel : tunnels ) {
              tunnel.setAssignedLocalPort( 0 );
          }
      }
docs: Closes the underlying ssh session causing all tunnels to be closed.