@Test public void testGetDefaultEndpoint() throws Exception { Endpoint endpoint = EndpointManager.getEndpointManager().getDefaultEndpoint(); assertThat(endpoint, is(notNullValue())); assertThat(endpoint.getUri(), is(notNullValue())); assertThat(endpoint.getUri().getScheme(), is(CoAP.COAP_URI_SCHEME)); assertThat(endpoint.isStarted(), is(true)); }
public synchronized Endpoint getDefaultEndpoint(String uriScheme) { if (null == uriScheme) { uriScheme = CoAP.COAP_URI_SCHEME; } if (!CoAP.isSupportedScheme(uriScheme)) { throw new IllegalArgumentException("URI scheme " + uriScheme + " not supported!"); } uriScheme = uriScheme.toLowerCase(); Endpoint endpoint = endpoints.get(uriScheme); if (null == endpoint) { if (CoAP.COAP_SECURE_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_SECURE_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else { endpoint = new CoapEndpoint.Builder().build(); } try { endpoint.start(); LOGGER.info("created implicit endpoint {} for {}", endpoint.getUri(), uriScheme); } catch (IOException e) { LOGGER.error("could not create {} endpoint", uriScheme, e); } endpoints.put(uriScheme, endpoint); } return endpoint; }
EndpointManager { public synchronized Endpoint getDefaultEndpoint(String uriScheme) { if (null == uriScheme) { uriScheme = CoAP.COAP_URI_SCHEME; } if (!CoAP.isSupportedScheme(uriScheme)) { throw new IllegalArgumentException("URI scheme " + uriScheme + " not supported!"); } uriScheme = uriScheme.toLowerCase(); Endpoint endpoint = endpoints.get(uriScheme); if (null == endpoint) { if (CoAP.COAP_SECURE_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_SECURE_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else { endpoint = new CoapEndpoint.Builder().build(); } try { endpoint.start(); LOGGER.info("created implicit endpoint {} for {}", endpoint.getUri(), uriScheme); } catch (IOException e) { LOGGER.error("could not create {} endpoint", uriScheme, e); } endpoints.put(uriScheme, endpoint); } return endpoint; } }
EndpointManager { public synchronized Endpoint getDefaultEndpoint(String uriScheme) { if (null == uriScheme) { uriScheme = CoAP.COAP_URI_SCHEME; } if (!CoAP.isSupportedScheme(uriScheme)) { throw new IllegalArgumentException("URI scheme " + uriScheme + " not supported!"); } uriScheme = uriScheme.toLowerCase(); Endpoint endpoint = endpoints.get(uriScheme); if (null == endpoint) { if (CoAP.COAP_SECURE_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_SECURE_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else { endpoint = new CoapEndpoint.Builder().build(); } try { endpoint.start(); LOGGER.info("created implicit endpoint {} for {}", endpoint.getUri(), uriScheme); } catch (IOException e) { LOGGER.error("could not create {} endpoint", uriScheme, e); } endpoints.put(uriScheme, endpoint); } return endpoint; }  }
EndpointManager { public synchronized Endpoint getDefaultEndpoint(String uriScheme) { if (null == uriScheme) { uriScheme = CoAP.COAP_URI_SCHEME; } if (!CoAP.isSupportedScheme(uriScheme)) { throw new IllegalArgumentException("URI scheme " + uriScheme + " not supported!"); } uriScheme = uriScheme.toLowerCase(); Endpoint endpoint = endpoints.get(uriScheme); if (null == endpoint) { if (CoAP.COAP_SECURE_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_SECURE_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else { endpoint = new CoapEndpoint.Builder().build(); } try { endpoint.start(); LOGGER.info("created implicit endpoint {} for {}", endpoint.getUri(), uriScheme); } catch (IOException e) { LOGGER.error("could not create {} endpoint", uriScheme, e); } endpoints.put(uriScheme, endpoint); } return endpoint; }  static EndpointManager getEndpointManager(); synchronized Endpoint getDefaultEndpoint(String uriScheme); synchronized void setDefaultEndpoint(Endpoint newEndpoint); Endpoint getDefaultEndpoint(); @Deprecated Collection<InetAddress> getNetworkInterfaces(); static void clear(); static void reset(); }
EndpointManager { public synchronized Endpoint getDefaultEndpoint(String uriScheme) { if (null == uriScheme) { uriScheme = CoAP.COAP_URI_SCHEME; } if (!CoAP.isSupportedScheme(uriScheme)) { throw new IllegalArgumentException("URI scheme " + uriScheme + " not supported!"); } uriScheme = uriScheme.toLowerCase(); Endpoint endpoint = endpoints.get(uriScheme); if (null == endpoint) { if (CoAP.COAP_SECURE_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else if (CoAP.COAP_SECURE_TCP_URI_SCHEME.equalsIgnoreCase(uriScheme)) { throw new IllegalStateException("URI scheme " + uriScheme + " requires a previous set connector!"); } else { endpoint = new CoapEndpoint.Builder().build(); } try { endpoint.start(); LOGGER.info("created implicit endpoint {} for {}", endpoint.getUri(), uriScheme); } catch (IOException e) { LOGGER.error("could not create {} endpoint", uriScheme, e); } endpoints.put(uriScheme, endpoint); } return endpoint; }  static EndpointManager getEndpointManager(); synchronized Endpoint getDefaultEndpoint(String uriScheme); synchronized void setDefaultEndpoint(Endpoint newEndpoint); Endpoint getDefaultEndpoint(); @Deprecated Collection<InetAddress> getNetworkInterfaces(); static void clear(); static void reset();  }