try {
serviceUnit.getEndpoints().remove(endpoint);
component.getRegistry().unregisterEndpoint((WSNEndpoint) endpoint);
((WSNEndpoint) endpoint).deactivate();
} catch (Exception e) {
throw new EndpointRegistrationException("Unable to activate endpoint", e);
}
}