use of org.eclipse.californium.core.CoapServer in project camel by apache.
the class CoAPComponent method getServer.
public synchronized CoapServer getServer(int port) {
CoapServer server = servers.get(port);
if (server == null && port == -1) {
server = defaultServer;
}
if (server == null && port == -1) {
server = servers.get(5684);
}
if (server == null) {
NetworkConfig config = new NetworkConfig();
//FIXME- configure the network stuff
server = new CoapServer(config, port);
servers.put(port, server);
if (this.isStarted()) {
server.start();
}
}
return server;
}
use of org.eclipse.californium.core.CoapServer in project camel by apache.
the class CoAPComponent method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
RestConfiguration config = getCamelContext().getRestConfiguration("coap", true);
// configure additional options on coap configuration
if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
setProperties(this, config.getComponentProperties());
}
defaultServer = getServer(config.getPort());
for (CoapServer s : servers.values()) {
s.start();
}
}
Aggregations