void stopRemoteTunnels(MultiplexedConnection agent, Collection<Tunnel> tunnels) throws CoreException { CoreException e = null; for (Tunnel tunnel : tunnels) { try { RemoteTunnel rt = RemoteTunnelManagerFactory.getInstance().getRemoteTunnel(tunnel.getResourceId()); if (rt != null) { rt.stopListener(); } else { throw new Exception("No active with ID for " + tunnel.getResourceId()); } } catch (Exception ex) { throw new TunnelException(TunnelException.INTERNAL_ERROR, ex); } } if (e != null) { throw e; } }