final Map<String, IoSession> registration = new ConcurrentHashMap<>();
// create a CoAP resource registry
final ResourceRegistry reg = new ResourceRegistry();
reg.register(new AbstractResourceHandler() {
@Override
public String getPath() {
return "demo";
}
@Override
public CoapResponse handle(CoapMessage request, IoSession session) {
return new CoapResponse(CoapCode.CONTENT.getCode(), "niah niah niah niah niah\n niah niah niah\n"
.getBytes(), new CoapOption(CoapOptionType.CONTENT_FORMAT, new byte[] { 0 }));
}
@Override
public String getTittle() {
return "Some demo resource";
}
});
reg.register(new AbstractResourceHandler() {
@Override
public CoapResponse handle(CoapMessage request, IoSession session) {
String device = null;
try {