	@Test
	public void testSetDefaultEndpoint() throws Exception {

		// GIVEN a old and a new endpoint
		Endpoint oldEndpoint = EndpointManager.getEndpointManager().getDefaultEndpoint();
		Endpoint endpoint = new CoapEndpoint.Builder().build();

		// WHEN set the new default endpoint
		EndpointManager.getEndpointManager().setDefaultEndpoint(endpoint);

		// THEN get the same new default endpoint and the old is stopped
		assertThat(EndpointManager.getEndpointManager().getDefaultEndpoint(), is(sameInstance(endpoint)));
		assertThat(oldEndpoint.isStarted(), is(false));
	}