Repository: eclipse/leshan
Pull request #68 (2016-02-04 10:56:53)

Enhance Demo
I have done some modification to make our demos CLI more intuitive.

sbernard31: Last change I would like to do, rename :
 * `leshan-standalone` in `leshan-server-demo`
 * `leshan-client-example` in `leshan-client-demo`
 * `leshan-bs-server` in `leshan-bsserver-demo`
What do you think ?

Patch:
diff --git a/.gitignore b/.gitignore
index 8a4cbe64..3e9e00e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,7 @@
 # Leshan config files #
 leshan-core/ddffiles
-leshan-standalone/Californium.properties
-leshan-standalone/data
-leshan-bs-server/data
-Californium.properties
+**/Californium.properties
+**/data/*.data
 
 # Binary files #
 *.class
diff --git a/README.md b/README.md
index 6fd492ab..64f41b94 100644
--- a/README.md
+++ b/README.md
@@ -34,18 +34,18 @@ Test Leshan locally
 -----------------------
 Get and run the last binary of our demo **server** :
 ```
-wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-standalone.jar
-java -jar ./leshan-standalone.jar
+wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-server-demo.jar
+java -jar ./leshan-server-demo.jar
 ```
 Get and run the last binary of our demo **client** :
 ```
-wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-client-example.jar
-java -jar ./leshan-client-example.jar
+wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-client-demo.jar
+java -jar ./leshan-client-demo.jar
 ```
 Get and run the last binary of our **boostrap** demo server :
 ```
-wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-bs-server.jar
-java -jar ./leshan-bs-server.jar
+wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-bsserver-demo.jar
+java -jar ./leshan-bsserver-demo.jar
 ```
 
 Compile & Run
@@ -57,22 +57,22 @@ mvn clean install
 
 Run demo **server**:
 ```
-java -jar target/leshan-standalone-*-SNAPSHOT-jar-with-dependencies.jar 
+java -jar target/leshan-server-demo-*-SNAPSHOT-jar-with-dependencies.jar 
 ```
 
 Connect on Leshan demo UI: http://localhost:8080  
 Leshan provides a very simple UI to get the list of connected clients and interact with clients resources.
 
-Now you can register a LWM2M client by running our **client** example:
+Now you can register a LWM2M client by running our **client** demo:
 ```
-java -jar target/leshan-client-example-*-SNAPSHOT-jar-with-dependencies.jar 
+java -jar target/leshan-client-demo-*-SNAPSHOT-jar-with-dependencies.jar 
 ```
 or trying the [Eclipse Wakaama](http://eclipse.org/wakaama) test client or script samples of its lua binding [lualwm2m] (https://github.com/sbernard31/lualwm2m).
 
 
 You can also try our **bootstrap** demo server:
 ```
-java -jar target/leshan-bs-server-*-SNAPSHOT-jar-with-dependencies.jar 
+java -jar target/leshan-bsserver-demo-*-SNAPSHOT-jar-with-dependencies.jar 
 ```
 
 ![Leshan](https://eclipse.org/leshan/img/capture_for_github.png)
@@ -102,8 +102,8 @@ Modules
 `Leshan-client-core` : client lwm2m logic.  
 `Leshan-client-cf` : client implementation based on [californium](https://github.com/eclipse/californium).  
 `Leshan-all` : every previous modules in 1 jar.  
-`Leshan-client-example` : a simple demo client.  
-`Leshan-standalone` : a lwm2m demo server with a web UI.  
-`Leshan-bs-server` : a bootstarp demo server with a web UI.  
+`Leshan-client-demo` : a simple demo client.  
+`Leshan-server-demo` : a lwm2m demo server with a web UI.  
+`Leshan-bsserver-demo` : a bootstarp demo server with a web UI.  
 `Leshan-integration-tests` : integration automatic tests.  
 
diff --git a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapMain.java b/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapMain.java
deleted file mode 100755
index 656931ad..00000000
--- a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapMain.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013-2015 Sierra Wireless and others.
- * 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Eclipse Distribution License v1.0 which accompany this distribution.
- * 
- * The Eclipse Public License is available at
- *    http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- *    http://www.eclipse.org/org/documents/edl-v10.html.
- * 
- * Contributors:
- *     Sierra Wireless - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.leshan.bootstrap;
-
-import java.net.InetSocketAddress;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.leshan.bootstrap.servlet.BootstrapServlet;
-import org.eclipse.leshan.server.californium.impl.LwM2mBootstrapServerImpl;
-import org.eclipse.leshan.server.security.SecurityStore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BootstrapMain {
-
-    private static final Logger LOG = LoggerFactory.getLogger(BootstrapMain.class);
-
-    private static String parseHost(String iface) {
-        return iface.substring(0, iface.lastIndexOf(':'));
-    }
-
-    private static int parsePort(String iface) {
-        return Integer.parseInt(iface.substring(iface.lastIndexOf(':') + 1, iface.length()));
-    }
-
-    public static void main(String[] args) {
-
-        BootstrapStoreImpl bsStore = new BootstrapStoreImpl();
-        SecurityStore securityStore = new BootstrapSecurityStore(bsStore);
-
-        // use those ENV variables for specifying the interface to be bound for coap and coaps
-        String iface = System.getenv("COAPIFACE");
-        String ifaces = System.getenv("COAPSIFACE");
-
-        LwM2mBootstrapServerImpl bsServer;
-
-        if (iface == null || iface.isEmpty() || ifaces == null || ifaces.isEmpty()) {
-            bsServer = new LwM2mBootstrapServerImpl(bsStore, securityStore);
-        } else {
-            // user specified the iface to be bound
-            bsServer = new LwM2mBootstrapServerImpl(new InetSocketAddress(parseHost(iface), parsePort(iface)),
-                    new InetSocketAddress(parseHost(ifaces), parsePort(ifaces)), bsStore, securityStore);
-        }
-
-        bsServer.start();
-        // now prepare and start jetty
-
-        String webPort = System.getenv("PORT");
-
-        if (webPort == null || webPort.isEmpty()) {
-            webPort = System.getProperty("PORT");
-        }
-
-        if (webPort == null || webPort.isEmpty()) {
-            webPort = "8080";
-        }
-
-        Server server = new Server(Integer.valueOf(webPort));
-        WebAppContext root = new WebAppContext();
-
-        root.setContextPath("/");
-        // root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
-        root.setResourceBase(BootstrapMain.class.getClassLoader().getResource("webapp").toExternalForm());
-
-        // root.setResourceBase(webappDirLocation);
-        root.setParentLoaderPriority(true);
-
-        ServletHolder bsServletHolder = new ServletHolder(new BootstrapServlet(bsStore));
-        root.addServlet(bsServletHolder, "/api/bootstrap/*");
-
-        server.setHandler(root);
-
-        try {
-            server.start();
-        } catch (Exception e) {
-            LOG.error("jetty error", e);
-        }
-
-    }
-}
diff --git a/leshan-bs-server/pom.xml b/leshan-bsserver-demo/pom.xml
similarity index 91%
rename from leshan-bs-server/pom.xml
rename to leshan-bsserver-demo/pom.xml
index d002da90..a7a80f52 100644
--- a/leshan-bs-server/pom.xml
+++ b/leshan-bsserver-demo/pom.xml
@@ -22,15 +22,19 @@ Contributors:
         <artifactId>leshan</artifactId>
         <version>0.1.11-M8-SNAPSHOT</version>
     </parent>
-    <artifactId>leshan-bs-server</artifactId>
-    <name>leshan - standalone bootstrap server</name>
-    <description>A LWM2M bootstrap server running an embedded Jetty server</description>
+    <artifactId>leshan-bsserver-demo</artifactId>
+    <name>leshan - bootstrap server demo</name>
+    <description>A LWM2M bootstrap demonstration server running an embedded Jetty server</description>
 
     <dependencies>
         <dependency>
             <groupId>org.eclipse.leshan</groupId>
             <artifactId>leshan-server-cf</artifactId>
         </dependency>
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+        </dependency>
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
@@ -85,7 +89,7 @@ Contributors:
                 <configuration>
                     <archive>
                         <manifest>
-                            <mainClass>org.eclipse.leshan.bootstrap.BootstrapMain</mainClass>
+                            <mainClass>org.eclipse.leshan.server.bootstrap.demo.LeshanBootstrapServerDemo</mainClass>
                         </manifest>
                     </archive>
                     <descriptorRefs>
diff --git a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapSecurityStore.java b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapSecurityStore.java
similarity index 98%
rename from leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapSecurityStore.java
rename to leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapSecurityStore.java
index e160d3e9..83e36856 100644
--- a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapSecurityStore.java
+++ b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapSecurityStore.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.bootstrap;
+package org.eclipse.leshan.server.bootstrap.demo;
 
 import java.util.Arrays;
 import java.util.Map;
diff --git a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapStoreImpl.java b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapStoreImpl.java
similarity index 96%
rename from leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapStoreImpl.java
rename to leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapStoreImpl.java
index d0e5d7ed..daf04458 100644
--- a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/BootstrapStoreImpl.java
+++ b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/BootstrapStoreImpl.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.bootstrap;
+package org.eclipse.leshan.server.bootstrap.demo;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -26,9 +26,9 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.commons.lang.Validate;
-import org.eclipse.leshan.bootstrap.ConfigurationChecker.ConfigurationException;
 import org.eclipse.leshan.server.bootstrap.BootstrapConfig;
 import org.eclipse.leshan.server.bootstrap.BootstrapStore;
+import org.eclipse.leshan.server.bootstrap.demo.ConfigurationChecker.ConfigurationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/ConfigurationChecker.java b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/ConfigurationChecker.java
similarity index 98%
rename from leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/ConfigurationChecker.java
rename to leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/ConfigurationChecker.java
index 16f36793..15bb4be3 100644
--- a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/ConfigurationChecker.java
+++ b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/ConfigurationChecker.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.bootstrap;
+package org.eclipse.leshan.server.bootstrap.demo;
 
 import java.util.Map;
 
diff --git a/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/LeshanBootstrapServerDemo.java b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/LeshanBootstrapServerDemo.java
new file mode 100755
index 00000000..dfe51d9e
--- /dev/null
+++ b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/LeshanBootstrapServerDemo.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2015 Sierra Wireless and others.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ * 
+ * The Eclipse Public License is available at
+ *    http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ *    http://www.eclipse.org/org/documents/edl-v10.html.
+ * 
+ * Contributors:
+ *     Sierra Wireless - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.leshan.server.bootstrap.demo;
+
+import java.net.BindException;
+import java.net.InetSocketAddress;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.leshan.server.bootstrap.demo.servlet.BootstrapServlet;
+import org.eclipse.leshan.server.californium.LeshanServerBuilder;
+import org.eclipse.leshan.server.californium.impl.LwM2mBootstrapServerImpl;
+import org.eclipse.leshan.server.security.SecurityStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LeshanBootstrapServerDemo {
+
+    private static final Logger LOG = LoggerFactory.getLogger(LeshanBootstrapServerDemo.class);
+
+    private final static String USAGE = "java -jar leshan-bsserver-demo.jar [OPTION]";
+    private final static String FOOTER = "All options could be passed using environment variables.(using long option name in uppercase)";
+
+    public static void main(String[] args) {
+
+        // Define options for command line tools
+        Options options = new Options();
+
+        options.addOption("h", "help", false, "Display help information.");
+        options.addOption("lh", "coaphost", true, "Set the local CoAP address.\n  Default: any local address.");
+        options.addOption("lp", "coapport", true, "Set the local CoAP port.\n  Default: 5683.");
+        options.addOption("slh", "coapshost", true, "Set the secure local CoAP address.\nDefault: any local address.");
+        options.addOption("slp", "coapsport", true, "Set the secure local CoAP port.\nDefault: 5684.");
+        options.addOption("wp", "webport", true, "Set the HTTP port for web server.\nDefault: 8080.");
+        HelpFormatter formatter = new HelpFormatter();
+        formatter.setOptionComparator(null);
+
+        // Parse arguments
+        CommandLine cl = null;
+        try {
+            cl = new DefaultParser().parse(options, args);
+        } catch (ParseException e) {
+            System.err.println("Parsing failed.  Reason: " + e.getMessage());
+            formatter.printHelp(USAGE, null, options, FOOTER);
+            return;
+        }
+
+        // Print help
+        if (cl.hasOption("help")) {
+            formatter.printHelp(USAGE, null, options, FOOTER);
+            return;
+        }
+
+        // Abort if unexpected options
+        if (cl.getArgs().length > 0) {
+            System.out.println("Unexpected option or arguments : " + cl.getArgList());
+            formatter.printHelp(USAGE, null, options, FOOTER);
+            return;
+        }
+
+        // Get local address
+        String localAddress = System.getenv("COAPHOST");
+        if (cl.hasOption("lh")) {
+            localAddress = cl.getOptionValue("lh");
+        }
+        if (localAddress == null)
+            localAddress = "0.0.0.0";
+        String localPortOption = System.getenv("COAPPORT");
+        if (cl.hasOption("lp")) {
+            localPortOption = cl.getOptionValue("lp");
+        }
+        int localPort = LeshanServerBuilder.PORT;
+        if (localPortOption != null) {
+            localPort = Integer.parseInt(localPortOption);
+        }
+
+        // Get secure local address
+        String secureLocalAddress = System.getenv("COAPSHOST");
+        if (cl.hasOption("slh")) {
+            secureLocalAddress = cl.getOptionValue("slh");
+        }
+        if (secureLocalAddress == null)
+            secureLocalAddress = "0.0.0.0";
+        String secureLocalPortOption = System.getenv("COAPSPORT");
+        if (cl.hasOption("slp")) {
+            secureLocalPortOption = cl.getOptionValue("slp");
+        }
+        int secureLocalPort = LeshanServerBuilder.PORT_DTLS;
+        if (secureLocalPortOption != null) {
+            secureLocalPort = Integer.parseInt(secureLocalPortOption);
+        }
+
+        // Get http port
+        String webPortOption = System.getenv("WEBPORT");
+        if (cl.hasOption("wp")) {
+            webPortOption = cl.getOptionValue("wp");
+        }
+        int webPort = 8080;
+        if (webPortOption != null) {
+            webPort = Integer.parseInt(webPortOption);
+        }
+
+        try {
+            createAndStartServer(webPort, localAddress, localPort, secureLocalAddress, secureLocalPort);
+        } catch (BindException e) {
+            System.out.println(String.format("Web port %s is alreay used, you could change it using 'webport' option.",
+                    webPort));
+            formatter.printHelp(USAGE, null, options, FOOTER);
+        } catch (Exception e) {
+            LOG.error("Jetty stopped with unexcepted error ...", e);
+        }
+    }
+
+    public static void createAndStartServer(int webPort, String localAddress, int localPort, String secureLocalAddress,
+            int secureLocalPort) throws Exception {
+
+        // Prepare and start bootstrap server
+        BootstrapStoreImpl bsStore = new BootstrapStoreImpl();
+        SecurityStore securityStore = new BootstrapSecurityStore(bsStore);
+
+        LwM2mBootstrapServerImpl bsServer = new LwM2mBootstrapServerImpl(
+                new InetSocketAddress(localAddress, localPort), new InetSocketAddress(secureLocalAddress,
+                        secureLocalPort), bsStore, securityStore);
+        bsServer.start();
+
+        // Now prepare and start jetty
+        Server server = new Server(webPort);
+        WebAppContext root = new WebAppContext();
+
+        root.setContextPath("/");
+        root.setResourceBase(LeshanBootstrapServerDemo.class.getClassLoader().getResource("webapp").toExternalForm());
+        root.setParentLoaderPriority(true);
+
+        ServletHolder bsServletHolder = new ServletHolder(new BootstrapServlet(bsStore));
+        root.addServlet(bsServletHolder, "/api/bootstrap/*");
+
+        server.setHandler(root);
+
+        server.start();
+        LOG.info("Web server started at {}.", server.getURI());
+    }
+}
diff --git a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/servlet/BootstrapServlet.java b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/servlet/BootstrapServlet.java
similarity index 95%
rename from leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/servlet/BootstrapServlet.java
rename to leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/servlet/BootstrapServlet.java
index 13fdde85..e347dac8 100644
--- a/leshan-bs-server/src/main/java/org/eclipse/leshan/bootstrap/servlet/BootstrapServlet.java
+++ b/leshan-bsserver-demo/src/main/java/org/eclipse/leshan/server/bootstrap/demo/servlet/BootstrapServlet.java
@@ -14,7 +14,7 @@
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
 
-package org.eclipse.leshan.bootstrap.servlet;
+package org.eclipse.leshan.server.bootstrap.demo.servlet;
 
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -26,9 +26,9 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.io.Charsets;
 import org.apache.commons.lang.StringUtils;
-import org.eclipse.leshan.bootstrap.BootstrapStoreImpl;
-import org.eclipse.leshan.bootstrap.ConfigurationChecker.ConfigurationException;
 import org.eclipse.leshan.server.bootstrap.BootstrapConfig;
+import org.eclipse.leshan.server.bootstrap.demo.BootstrapStoreImpl;
+import org.eclipse.leshan.server.bootstrap.demo.ConfigurationChecker.ConfigurationException;
 
 import com.google.gson.Gson;
 import com.google.gson.JsonSyntaxException;
diff --git a/leshan-bs-server/src/main/resources/log4j2.xml b/leshan-bsserver-demo/src/main/resources/log4j2.xml
similarity index 85%
rename from leshan-bs-server/src/main/resources/log4j2.xml
rename to leshan-bsserver-demo/src/main/resources/log4j2.xml
index 6b56a6b6..e90cab82 100644
--- a/leshan-bs-server/src/main/resources/log4j2.xml
+++ b/leshan-bsserver-demo/src/main/resources/log4j2.xml
@@ -16,12 +16,12 @@ Contributors:
     Sierra Wireless - initial API and implementation
 
  -->
-<Configuration status="warn" strict="true" name="leshan standalone"
+<Configuration status="warn" strict="true" name="leshan bootstrap server demo"
                packages="org.apache.logging.log4j.test">
 
   <Appenders>
     <Appender type="Console" name="STDOUT">
-      <Layout type="PatternLayout" pattern="%d %p %C{1.} [%t] %m%n"/>
+      <Layout type="PatternLayout" pattern="[%d %p %C{0}] %m%n"/>
     </Appender>
   </Appenders>
  
diff --git a/leshan-bs-server/src/main/resources/webapp/css/lw-app.css b/leshan-bsserver-demo/src/main/resources/webapp/css/lw-app.css
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/css/lw-app.css
rename to leshan-bsserver-demo/src/main/resources/webapp/css/lw-app.css
diff --git a/leshan-bs-server/src/main/resources/webapp/img/fav_icon.png b/leshan-bsserver-demo/src/main/resources/webapp/img/fav_icon.png
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/img/fav_icon.png
rename to leshan-bsserver-demo/src/main/resources/webapp/img/fav_icon.png
diff --git a/leshan-bs-server/src/main/resources/webapp/img/logo.png b/leshan-bsserver-demo/src/main/resources/webapp/img/logo.png
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/img/logo.png
rename to leshan-bsserver-demo/src/main/resources/webapp/img/logo.png
diff --git a/leshan-bs-server/src/main/resources/webapp/index.html b/leshan-bsserver-demo/src/main/resources/webapp/index.html
similarity index 97%
rename from leshan-bs-server/src/main/resources/webapp/index.html
rename to leshan-bsserver-demo/src/main/resources/webapp/index.html
index c144ed41..7b55cf7c 100644
--- a/leshan-bs-server/src/main/resources/webapp/index.html
+++ b/leshan-bsserver-demo/src/main/resources/webapp/index.html
@@ -2,7 +2,7 @@
 <html lang="en">
     <head>
         <meta charset="utf-8">
-        <title>Leshan Bootstrap</title>
+        <title>Leshan Bootstrap Demo</title>
 
         <link rel="stylesheet" href="vendor/css/bootstrap.min.css">
         <link rel="stylesheet" href="css/lw-app.css" />
diff --git a/leshan-bs-server/src/main/resources/webapp/js/bsconfigstore.js b/leshan-bsserver-demo/src/main/resources/webapp/js/bsconfigstore.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/js/bsconfigstore.js
rename to leshan-bsserver-demo/src/main/resources/webapp/js/bsconfigstore.js
diff --git a/leshan-bs-server/src/main/resources/webapp/tag/bootstrap-modal.tag b/leshan-bsserver-demo/src/main/resources/webapp/tag/bootstrap-modal.tag
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/tag/bootstrap-modal.tag
rename to leshan-bsserver-demo/src/main/resources/webapp/tag/bootstrap-modal.tag
diff --git a/leshan-bs-server/src/main/resources/webapp/tag/bootstrap.tag b/leshan-bsserver-demo/src/main/resources/webapp/tag/bootstrap.tag
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/tag/bootstrap.tag
rename to leshan-bsserver-demo/src/main/resources/webapp/tag/bootstrap.tag
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap-theme.css b/leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap-theme.css
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map b/leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css b/leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap.css b/leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap.css
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap.css
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap.css
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap.css.map b/leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap.css.map
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap.css.map
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap.css.map
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap.min.css b/leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap.min.css
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/css/bootstrap.min.css
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/css/bootstrap.min.css
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot b/leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg b/leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf b/leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff b/leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/bootstrap.min.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/bootstrap.min.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/bootstrap.min.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/bootstrap.min.js
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/jquery-2.1.1.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/jquery-2.1.1.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.js
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/riot+compiler.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot+compiler.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/riot+compiler.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot+compiler.js
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/riot+compiler.min.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot+compiler.min.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/riot+compiler.min.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot+compiler.min.js
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/riot.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/riot.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot.js
diff --git a/leshan-bs-server/src/main/resources/webapp/vendor/js/riot.min.js b/leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot.min.js
similarity index 100%
rename from leshan-bs-server/src/main/resources/webapp/vendor/js/riot.min.js
rename to leshan-bsserver-demo/src/main/resources/webapp/vendor/js/riot.min.js
diff --git a/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/LeshanClient.java b/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/LeshanClient.java
index c999264c..48c37ea6 100644
--- a/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/LeshanClient.java
+++ b/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/LeshanClient.java
@@ -124,7 +124,6 @@ public class LeshanClient implements LwM2mClient {
         Runtime.getRuntime().addShutdownHook(new Thread() {
             @Override
             public void run() {
-                LOG.debug("Deregistering on shutdown");
                 LeshanClient.this.destroy();
             }
         });
@@ -132,20 +131,26 @@ public class LeshanClient implements LwM2mClient {
 
     @Override
     public void start() {
+        LOG.info("Starting Leshan client ...");
         clientSideServer.start();
         engine.start();
+        LOG.info("Leshan client started.");
     }
 
     @Override
     public void stop() {
+        LOG.info("Stopping Leshan Client ...");
         engine.stop();
         clientSideServer.stop();
+        LOG.info("Leshan client stopped.");
     }
 
     @Override
     public void destroy() {
+        LOG.info("Destroying Leshan client ...");
         engine.stop();
         clientSideServer.destroy();
+        LOG.info("Leshan client destroyed.");
     }
 
     @Override
diff --git a/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/impl/CaliforniumLwM2mClientRequestSender.java b/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/impl/CaliforniumLwM2mClientRequestSender.java
index dcf4d2d6..f33b733d 100644
--- a/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/impl/CaliforniumLwM2mClientRequestSender.java
+++ b/leshan-client-cf/src/main/java/org/eclipse/leshan/client/californium/impl/CaliforniumLwM2mClientRequestSender.java
@@ -47,7 +47,7 @@ public class CaliforniumLwM2mClientRequestSender implements LwM2mClientRequestSe
 
     @Override
     public <T extends LwM2mResponse> T send(final InetSocketAddress serverAddress, final boolean secure,
-            final UplinkRequest<T> request, Long timeout) {
+            final UplinkRequest<T> request, Long timeout) throws InterruptedException {
         // Create the CoAP request from LwM2m request
         final CoapClientRequestBuilder coapClientRequestBuilder = new CoapClientRequestBuilder(serverAddress);
         request.accept(coapClientRequestBuilder);
@@ -219,7 +219,7 @@ public class CaliforniumLwM2mClientRequestSender implements LwM2mClientRequestSe
             latch.countDown();
         }
 
-        public T waitForResponse() {
+        public T waitForResponse() throws InterruptedException {
             try {
                 boolean timeElapsed = false;
                 if (timeout != null) {
@@ -230,10 +230,6 @@ public class CaliforniumLwM2mClientRequestSender implements LwM2mClientRequestSe
                 if (timeElapsed || coapTimeout.get()) {
                     coapRequest.cancel();
                 }
-            } catch (final InterruptedException e) {
-                // no idea why some other thread should have interrupted this thread
-                // but anyway, go ahead as if the timeout had been reached
-                LOG.debug("Caught an unexpected InterruptedException during execution of CoAP request", e);
             } finally {
                 coapRequest.removeMessageObserver(this);
             }
diff --git a/leshan-client-core/src/main/java/org/eclipse/leshan/client/request/LwM2mClientRequestSender.java b/leshan-client-core/src/main/java/org/eclipse/leshan/client/request/LwM2mClientRequestSender.java
index 517d4f22..6eac056f 100644
--- a/leshan-client-core/src/main/java/org/eclipse/leshan/client/request/LwM2mClientRequestSender.java
+++ b/leshan-client-core/src/main/java/org/eclipse/leshan/client/request/LwM2mClientRequestSender.java
@@ -31,7 +31,7 @@ public interface LwM2mClientRequestSender {
      *         timeout) expires.
      */
     <T extends LwM2mResponse> T send(final InetSocketAddress server, final boolean secure,
-            final UplinkRequest<T> request, Long timeout);
+            final UplinkRequest<T> request, Long timeout) throws InterruptedException;
 
     /**
      * Send a Lightweight M2M request asynchronously.
diff --git a/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/BootstrapHandler.java b/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/BootstrapHandler.java
index cc28c85b..2c5ec798 100644
--- a/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/BootstrapHandler.java
+++ b/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/BootstrapHandler.java
@@ -100,12 +100,8 @@ public class BootstrapHandler {
         return false;
     }
 
-    public boolean waitBoostrapFinished(long timeInSeconds) {
-        try {
-            return bootstrappingLatch.await(timeInSeconds, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-            return false;
-        }
+    public boolean waitBoostrapFinished(long timeInSeconds) throws InterruptedException {
+        return bootstrappingLatch.await(timeInSeconds, TimeUnit.SECONDS);
     }
 
     public synchronized void closeSession() {
diff --git a/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/RegistrationEngine.java b/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/RegistrationEngine.java
index 338c312d..56318162 100644
--- a/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/RegistrationEngine.java
+++ b/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/RegistrationEngine.java
@@ -52,6 +52,7 @@ public class RegistrationEngine {
     private static final Logger LOG = LoggerFactory.getLogger(RegistrationEngine.class);
     // TODO bootstrap timeout should be configurable
     private static final int BS_TIMEOUT = 93; // in seconds (93s is the COAP MAX_TRANSMIT_WAIT with default config)
+    private static final long DEREGISTRATION_TIMEOUT = 1000; // in ms, de-registration is only used on stop for now.
     // TODO time between bootstrap retry should be configurable and incremental
     private static final int BS_RETRY = 10 * 60; // in seconds
 
@@ -75,61 +76,63 @@ public class RegistrationEngine {
     }
 
     public void start() {
-        schedExecutor.submit(new BootstrapTask());
+        schedExecutor.submit(new RegistrationTask());
     }
 
-    private boolean bootstrap() {
+    private boolean bootstrap() throws InterruptedException {
         ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
 
         if (serversInfo.bootstrap == null) {
-            throw new IllegalStateException("Missing info to boostrap the client");
+            LOG.error("Trying to bootstrap device but there is no bootstrap server config.");
+            return false;
         }
 
         if (bootstrapHandler.tryToInitSession(serversInfo.bootstrap)) {
-            LOG.info("Starting bootstrap session ");
+            LOG.info("Trying to start bootstrap session to {} ...", serversInfo.bootstrap.serverUri);
             try {
                 // Send bootstrap request
                 ServerInfo boostrapServer = serversInfo.bootstrap;
                 BootstrapResponse response = sender.send(boostrapServer.getAddress(), boostrapServer.isSecure(),
                         new BootstrapRequest(endpoint), null);
                 if (response == null) {
-                    LOG.error("Bootstrap failed: timeout");
+                    LOG.error("Unable to start bootstrap session: Timeout.");
                     return false;
                 } else if (response.isSuccess()) {
                     LOG.info("Bootstrap started");
                     // wait until it is finished (or too late)
                     boolean timeout = !bootstrapHandler.waitBoostrapFinished(BS_TIMEOUT);
                     if (timeout) {
-                        LOG.error("Bootstrap sequence timeout");
+                        LOG.error("Bootstrap sequence aborted: Timeout.");
                         return false;
                     } else {
                         serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
-                        LOG.info("Bootstrap finished {}", serversInfo);
+                        LOG.info("Bootstrap finished {}.", serversInfo);
                         return true;
                     }
                 } else {
-                    LOG.error("Bootstrap failed: {}", response.getCode());
+                    LOG.error("Bootstrap failed: {}.", response.getCode());
                     return false;
                 }
             } finally {
                 bootstrapHandler.closeSession();
             }
         } else {
-            LOG.info("Bootstrap sequence already started");
+            LOG.warn("Bootstrap sequence already started.");
             return false;
         }
     }
 
-    private boolean register() {
+    private boolean register() throws InterruptedException {
         ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
         DmServerInfo dmInfo = serversInfo.deviceMangements.values().iterator().next();
 
         if (dmInfo == null) {
-            LOG.error("Missing info to register to a DM server");
+            LOG.error("Trying to register device but there is no LWM2M server config.");
             return false;
         }
 
         // send register request
+        LOG.info("Trying to register to {} ...", dmInfo.serverUri);
         RegisterResponse response = sender.send(
                 dmInfo.getAddress(),
                 dmInfo.isSecure(),
@@ -137,126 +140,142 @@ public class RegistrationEngine {
                         .getClientDescription(objectEnablers.values(), null), null), null);
         if (response == null) {
             registrationID = null;
-            LOG.error("Registration failed: timeout");
+            LOG.error("Registration failed: Timeout.");
         } else if (response.isSuccess()) {
             registrationID = response.getRegistrationID();
 
             // update every lifetime period
             scheduleUpdate(dmInfo);
 
-            LOG.info("Registered with location '{}'", response.getRegistrationID());
+            LOG.info("Registered with location '{}'.", response.getRegistrationID());
         } else {
             registrationID = null;
-            LOG.info("Registration failed: {}", response.getCode());
+            LOG.error("Registration failed: {}.", response.getCode());
         }
 
         return registrationID != null;
     }
 
-    private boolean deregister() {
+    private boolean deregister() throws InterruptedException {
         if (registrationID == null)
             return true;
 
         ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
         DmServerInfo dmInfo = serversInfo.deviceMangements.values().iterator().next();
         if (dmInfo == null) {
-            LOG.error("Missing info to deregister to a DM server");
+            LOG.error("Trying to deregister device but there is no LWM2M server config.");
             return false;
         }
 
         // Send deregister request
+        LOG.info("Trying to deregister to {} ...", dmInfo.serverUri);
         DeregisterResponse response = sender.send(dmInfo.getAddress(), dmInfo.isSecure(), new DeregisterRequest(
-                registrationID), null);
+                registrationID), DEREGISTRATION_TIMEOUT);
         if (response == null) {
             registrationID = null;
-            LOG.info("Deregistration failed: timeout");
+            LOG.error("Deregistration failed: Timeout.");
             return false;
         } else if (response.isSuccess() || response.getCode() == ResponseCode.NOT_FOUND) {
             registrationID = null;
             cancelUpdateTask();
-            LOG.info("De-register response:" + response);
+            LOG.info("De-register response {} {}.", response.getCode(), response.getErrorMessage());
             return true;
         } else {
-            LOG.info("Deregistration failed: {}", response);
+            LOG.error("Deregistration failed: {} {}.", response.getCode(), response.getErrorMessage());
             return false;
         }
     }
 
-    private boolean update() {
+    private boolean update() throws InterruptedException {
         cancelUpdateTask();
 
         ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
         DmServerInfo dmInfo = serversInfo.deviceMangements.values().iterator().next();
         if (dmInfo == null) {
-            LOG.error("Missing info to update registration to a DM server");
+            LOG.error("Trying to update registration but there is no LWM2M server config.");
             return false;
         }
 
         // Send update
+        LOG.info("Trying to update registration to {} ...", dmInfo.serverUri);
         final UpdateResponse response = sender.send(dmInfo.getAddress(), dmInfo.isSecure(), new UpdateRequest(
                 registrationID, null, null, null, null), null);
         if (response == null) {
             registrationID = null;
-            LOG.info("Registration update failed: timeout");
+            LOG.error("Registration update failed: Timeout.");
             return false;
         } else if (response.getCode() == ResponseCode.CHANGED) {
             // Update successful, so we reschedule new update
             scheduleUpdate(dmInfo);
-            LOG.info("Registration update: {}", response.getCode());
+            LOG.info("Registration update succeed.");
             return true;
         } else {
-            LOG.info("Registration update failed: {}", response);
+            LOG.error("Registration update failed: {} {}.", response.getCode(), response.getErrorMessage());
             return false;
         }
 
     }
 
-    private class BootstrapTask implements Runnable {
+    private class RegistrationTask implements Runnable {
         @Override
         public void run() {
-            ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
-            if (!serversInfo.deviceMangements.isEmpty()) {
-                if (!register()) {
+            try {
+                ServersInfo serversInfo = ServersInfoExtractor.getInfo(objectEnablers);
+                if (!serversInfo.deviceMangements.isEmpty()) {
+                    if (!register()) {
+                        if (!bootstrap()) {
+                            scheduleRegistration();
+                        } else {
+                            if (!register()) {
+                                scheduleRegistration();
+                            }
+                        }
+                    }
+                } else {
                     if (!bootstrap()) {
-                        schedExecutor.schedule(new BootstrapTask(), BS_RETRY, TimeUnit.SECONDS);
+                        scheduleRegistration();
                     } else {
                         if (!register()) {
-                            schedExecutor.schedule(new BootstrapTask(), BS_RETRY, TimeUnit.SECONDS);
+                            scheduleRegistration();
                         }
                     }
                 }
-            } else {
-                if (!bootstrap()) {
-                    schedExecutor.schedule(new BootstrapTask(), BS_RETRY, TimeUnit.SECONDS);
-                } else {
-                    if (!register()) {
-                        schedExecutor.schedule(new BootstrapTask(), BS_RETRY, TimeUnit.SECONDS);
-                    }
-                }
+            } catch (InterruptedException e) {
+                LOG.info("Registration task interrupted.");
             }
         }
     }
 
+    private void scheduleRegistration() {
+        LOG.info("Unable to connect to any server, next retry in {}s...", BS_RETRY);
+        schedExecutor.schedule(new RegistrationTask(), BS_RETRY, TimeUnit.SECONDS);
+    }
+
     private void scheduleUpdate(DmServerInfo dmInfo) {
         // calculate next update : lifetime - 10%
         // dmInfo.lifetime is in seconds
         long nextUpdate = dmInfo.lifetime * 900l;
+        LOG.info("Next registration update in {}s...", nextUpdate / 1000.0);
         updateFuture = schedExecutor.schedule(new UpdateRegistrationTask(), nextUpdate, TimeUnit.MILLISECONDS);
     }
 
     private class UpdateRegistrationTask implements Runnable {
         @Override
         public void run() {
-            if (!update()) {
-                if (!register()) {
-                    if (!bootstrap()) {
-                        schedExecutor.schedule(new BootstrapTask(), BS_RETRY, TimeUnit.SECONDS);
-                    } else {
-                        if (!register()) {
-                            schedExecutor.schedule(new BootstrapTask(), BS_RETRY, TimeUnit.SECONDS);
+            try {
+                if (!update()) {
+                    if (!register()) {
+                        if (!bootstrap()) {
+                            scheduleRegistration();
+                        } else {
+                            if (!register()) {
+                                scheduleRegistration();
+                            }
                         }
                     }
                 }
+            } catch (InterruptedException e) {
+                LOG.info("Registration update task interrupted.");
             }
         }
     }
@@ -271,9 +290,9 @@ public class RegistrationEngine {
         // TODO we should manage the case where we stop in the middle of a bootstrap session ...
         schedExecutor.shutdownNow();
         try {
-            schedExecutor.awaitTermination(BS_RETRY, TimeUnit.SECONDS);
+            schedExecutor.awaitTermination(BS_TIMEOUT, TimeUnit.SECONDS);
+            deregister();
         } catch (InterruptedException e) {
         }
-        deregister();
     }
 }
diff --git a/leshan-client-example/pom.xml b/leshan-client-demo/pom.xml
similarity index 95%
rename from leshan-client-example/pom.xml
rename to leshan-client-demo/pom.xml
index 55fd2f92..e5b6b2fc 100644
--- a/leshan-client-example/pom.xml
+++ b/leshan-client-demo/pom.xml
@@ -22,8 +22,8 @@ Contributors:
         <artifactId>leshan</artifactId>
         <version>0.1.11-M8-SNAPSHOT</version>
     </parent>
-    <artifactId>leshan-client-example</artifactId>
-    <name>leshan - client example</name>
+    <artifactId>leshan-client-demo</artifactId>
+    <name>leshan - client demo</name>
     <description>A demonstration client built upon the Leshan client.</description>
 
     <dependencies>
@@ -58,7 +58,7 @@ Contributors:
                 <configuration>
                     <archive>
                         <manifest>
-                            <mainClass>org.eclipse.leshan.client.example.LeshanClientExample</mainClass>
+                            <mainClass>org.eclipse.leshan.client.demo.LeshanClientDemo</mainClass>
                         </manifest>
                     </archive>
                     <descriptorRefs>
diff --git a/leshan-client-example/src/main/java/org/eclipse/leshan/client/example/LeshanClientExample.java b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java
similarity index 82%
rename from leshan-client-example/src/main/java/org/eclipse/leshan/client/example/LeshanClientExample.java
rename to leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java
index bb0927bd..1c3f2dd6 100644
--- a/leshan-client-example/src/main/java/org/eclipse/leshan/client/example/LeshanClientExample.java
+++ b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java
@@ -16,7 +16,7 @@
  *     Bosch Software Innovations GmbH, - initial API and implementation
  *******************************************************************************/
 
-package org.eclipse.leshan.client.example;
+package org.eclipse.leshan.client.demo;
 
 import static org.eclipse.leshan.LwM2mId.DEVICE;
 import static org.eclipse.leshan.LwM2mId.LOCATION;
@@ -44,38 +44,37 @@ import org.eclipse.leshan.client.resource.LwM2mObjectEnabler;
 import org.eclipse.leshan.client.resource.ObjectsInitializer;
 import org.eclipse.leshan.core.request.BindingMode;
 import org.eclipse.leshan.util.Hex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-/*
- * To build: 
- * mvn assembly:assembly -DdescriptorId=jar-with-dependencies
- * To use:
- * java -jar target/leshan-client-*-SNAPSHOT-jar-with-dependencies.jar 127.0.0.1 5683
- */
-public class LeshanClientExample {
+public class LeshanClientDemo {
 
-    private final static String DEFAULT_ENDPOINT = "LeshanClientExample";
+    private static final Logger LOG = LoggerFactory.getLogger(LeshanClientDemo.class);
+
+    private final static String DEFAULT_ENDPOINT = "LeshanClientDemo";
     private final static MyLocation locationInstance = new MyLocation();
+    private final static String USAGE = "java -jar leshan-client-demo.jar [OPTION]";
 
     public static void main(final String[] args) {
+
         // Define options for command line tools
         Options options = new Options();
 
         options.addOption("h", "help", false, "Display help information.");
         options.addOption("n", true, String.format(
-                "Set the endpoint name of the Client. Default: the local hostname or '%s' if we can not find it.",
-                DEFAULT_ENDPOINT));
+                "Set the endpoint name of the Client.\nDefault: the local hostname or '%s' if any.", DEFAULT_ENDPOINT));
         options.addOption("b", false, "If present use bootstrap.");
-        options.addOption("lh", true, "Set the local address of the Client. Default: any local address.");
+        options.addOption("lh", true, "Set the local CoAP address of the Client.\n  Default: any local address.");
         options.addOption("lp", true,
-                "Set the local port of the Client. Default: A valid port value is between 0 and 65535..");
-        options.addOption("slh", true, "Set the secure local address of the Client. Default: any local address.");
+                "Set the local CoAP port of the Client.\n  Default: A valid port value is between 0 and 65535.");
+        options.addOption("slh", true, "Set the secure local CoAP address of the Client.\nDefault: any local address.");
         options.addOption("slp", true,
-                "Set the secure local port of the Client. Default: A valid port value is between 0 and 65535..");
-        options.addOption("u", true, "Set the device management or bootstrap server URL. Default: localhost:5683.");
+                "Set the secure local CoAP port of the Client.\nDefault: A valid port value is between 0 and 65535.");
+        options.addOption("u", true, "Set the LWM2M or Bootstrap server URL.\nDefault: localhost:5683.");
         options.addOption("i", true,
-                "Set the device management or bootstrap server PSK identity in ascii. Use none secure mode if not set.");
+                "Set the LWM2M or Bootstrap server PSK identity in ascii.\nUse none secure mode if not set.");
         options.addOption("p", true,
-                "Set the device management or bootstrap server Pre-Shared-Key in hexadecimal. Use none secure mode if not set.");
+                "Set the LWM2M or Bootstrap server Pre-Shared-Key in hexa.\nUse none secure mode if not set.");
         HelpFormatter formatter = new HelpFormatter();
         formatter.setOptionComparator(null);
 
@@ -85,27 +84,27 @@ public class LeshanClientExample {
             cl = new DefaultParser().parse(options, args);
         } catch (ParseException e) {
             System.err.println("Parsing failed.  Reason: " + e.getMessage());
-            formatter.printHelp("LeshanClientExample", options);
+            formatter.printHelp(USAGE, options);
             return;
         }
 
         // Print help
         if (cl.hasOption("help")) {
-            formatter.printHelp("LeshanClientExample", options);
+            formatter.printHelp(USAGE, options);
             return;
         }
 
         // Abort if unexpected options
         if (cl.getArgs().length > 0) {
             System.out.println("Unexpected option or arguments : " + cl.getArgList());
-            formatter.printHelp("LeshanClientExample", options);
+            formatter.printHelp(USAGE, options);
             return;
         }
 
         // Abort if we have not identity and key for psk.
         if ((cl.hasOption("i") && !cl.hasOption("p")) || !cl.hasOption("i") && cl.hasOption("p")) {
             System.out.println("You should precise identity and Pre-Shared-Key if you want to connect in PSK");
-            formatter.printHelp("LeshanClientExample", options);
+            formatter.printHelp(USAGE, options);
             return;
         }
 
@@ -117,7 +116,7 @@ public class LeshanClientExample {
             try {
                 endpoint = InetAddress.getLocalHost().getHostName();
             } catch (UnknownHostException e) {
-                endpoint = "LeshanClientExample";
+                endpoint = DEFAULT_ENDPOINT;
             }
         }
 
@@ -198,12 +197,13 @@ public class LeshanClientExample {
         builder.setObjects(enablers);
         final LeshanClient client = builder.build();
 
+        LOG.info("Press 'w','a','s','d' to change reported Location.");
+
         // Start the client
         client.start();
 
         // Change the location through the Console
         Scanner scanner = new Scanner(System.in);
-        System.out.println("Press 'w','a','s','d' to change reported Location.");
         while (scanner.hasNext()) {
             String nextMove = scanner.next();
             locationInstance.moveLocation(nextMove);
diff --git a/leshan-client-example/src/main/java/org/eclipse/leshan/client/example/MyDevice.java b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/MyDevice.java
similarity index 90%
rename from leshan-client-example/src/main/java/org/eclipse/leshan/client/example/MyDevice.java
rename to leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/MyDevice.java
index 1cdd7610..f53e258c 100644
--- a/leshan-client-example/src/main/java/org/eclipse/leshan/client/example/MyDevice.java
+++ b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/MyDevice.java
@@ -1,4 +1,4 @@
-package org.eclipse.leshan.client.example;
+package org.eclipse.leshan.client.demo;
 
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
@@ -16,9 +16,13 @@ import org.eclipse.leshan.core.node.LwM2mResource;
 import org.eclipse.leshan.core.response.ExecuteResponse;
 import org.eclipse.leshan.core.response.ReadResponse;
 import org.eclipse.leshan.core.response.WriteResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MyDevice extends BaseInstanceEnabler {
 
+    private static final Logger LOG = LoggerFactory.getLogger(MyDevice.class);
+
     public MyDevice() {
         // notify new date each 5 second
         Timer timer = new Timer();
@@ -32,7 +36,7 @@ public class MyDevice extends BaseInstanceEnabler {
 
     @Override
     public ReadResponse read(int resourceid) {
-        System.out.println("Read on Device Resource " + resourceid);
+        LOG.info("Read on Device Resource " + resourceid);
         switch (resourceid) {
         case 0:
             return ReadResponse.success(resourceid, getManufacturer());
@@ -65,7 +69,7 @@ public class MyDevice extends BaseInstanceEnabler {
 
     @Override
     public ExecuteResponse execute(int resourceid, String params) {
-        System.out.println("Execute on Device resource " + resourceid);
+        LOG.info("Execute on Device resource " + resourceid);
         if (params != null && params.length() != 0)
             System.out.println("\t params " + params);
         return ExecuteResponse.success();
@@ -73,7 +77,7 @@ public class MyDevice extends BaseInstanceEnabler {
 
     @Override
     public WriteResponse write(int resourceid, LwM2mResource value) {
-        System.out.println("Write on Device Resource " + resourceid + " value " + value);
+        LOG.info("Write on Device Resource " + resourceid + " value " + value);
         switch (resourceid) {
         case 13:
             return WriteResponse.notFound();
@@ -91,7 +95,7 @@ public class MyDevice extends BaseInstanceEnabler {
     }
 
     private String getManufacturer() {
-        return "Leshan Example Device";
+        return "Leshan Demo Device";
     }
 
     private String getModelNumber() {
diff --git a/leshan-client-example/src/main/java/org/eclipse/leshan/client/example/MyLocation.java b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/MyLocation.java
similarity index 88%
rename from leshan-client-example/src/main/java/org/eclipse/leshan/client/example/MyLocation.java
rename to leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/MyLocation.java
index dbf57847..067b384a 100644
--- a/leshan-client-example/src/main/java/org/eclipse/leshan/client/example/MyLocation.java
+++ b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/MyLocation.java
@@ -1,12 +1,17 @@
-package org.eclipse.leshan.client.example;
+package org.eclipse.leshan.client.demo;
 
 import java.util.Date;
 import java.util.Random;
 
 import org.eclipse.leshan.client.resource.BaseInstanceEnabler;
 import org.eclipse.leshan.core.response.ReadResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MyLocation extends BaseInstanceEnabler {
+
+    private static final Logger LOG = LoggerFactory.getLogger(MyLocation.class);
+
     private Random random;
     private float latitude;
     private float longitude;
@@ -21,7 +26,7 @@ public class MyLocation extends BaseInstanceEnabler {
 
     @Override
     public ReadResponse read(int resourceid) {
-        System.out.println("Read on Location Resource " + resourceid);
+        LOG.info("Read on Location Resource " + resourceid);
         switch (resourceid) {
         case 0:
             return ReadResponse.success(resourceid, getLatitude());
diff --git a/leshan-standalone/src/main/resources/log4j2.xml b/leshan-client-demo/src/main/resources/log4j2.xml
similarity index 85%
rename from leshan-standalone/src/main/resources/log4j2.xml
rename to leshan-client-demo/src/main/resources/log4j2.xml
index 6b56a6b6..734040ec 100644
--- a/leshan-standalone/src/main/resources/log4j2.xml
+++ b/leshan-client-demo/src/main/resources/log4j2.xml
@@ -16,12 +16,12 @@ Contributors:
     Sierra Wireless - initial API and implementation
 
  -->
-<Configuration status="warn" strict="true" name="leshan standalone"
+<Configuration status="warn" strict="true" name="leshan client demo"
                packages="org.apache.logging.log4j.test">
 
   <Appenders>
     <Appender type="Console" name="STDOUT">
-      <Layout type="PatternLayout" pattern="%d %p %C{1.} [%t] %m%n"/>
+      <Layout type="PatternLayout" pattern="[%d %p %C{0}] %m%n"/>
     </Appender>
   </Appenders>
  
diff --git a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServerBuilder.java b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServerBuilder.java
index ef241bca..7215e524 100644
--- a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServerBuilder.java
+++ b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServerBuilder.java
@@ -47,10 +47,14 @@ public class LeshanServerBuilder {
     private ClientRegistry clientRegistry;
     private LwM2mModelProvider modelProvider;
     private InetSocketAddress localAddress;
-    private InetSocketAddress localAddressSecure;
+    private InetSocketAddress localSecureAddress;
 
     public LeshanServerBuilder setLocalAddress(String hostname, int port) {
-        this.localAddress = new InetSocketAddress(hostname, port);
+        if (hostname == null) {
+            this.localAddress = new InetSocketAddress(port);
+        } else {
+            this.localAddress = new InetSocketAddress(hostname, port);
+        }
         return this;
     }
 
@@ -59,13 +63,17 @@ public class LeshanServerBuilder {
         return this;
     }
 
-    public LeshanServerBuilder setLocalAddressSecure(String hostname, int port) {
-        this.localAddressSecure = new InetSocketAddress(hostname, port);
+    public LeshanServerBuilder setLocalSecureAddress(String hostname, int port) {
+        if (hostname == null) {
+            this.localSecureAddress = new InetSocketAddress(port);
+        } else {
+            this.localSecureAddress = new InetSocketAddress(hostname, port);
+        }
         return this;
     }
 
-    public LeshanServerBuilder setLocalAddressSecure(InetSocketAddress localAddressSecure) {
-        this.localAddressSecure = localAddressSecure;
+    public LeshanServerBuilder setLocalSecureAddress(InetSocketAddress localSecureAddress) {
+        this.localSecureAddress = localSecureAddress;
         return this;
     }
 
@@ -92,8 +100,8 @@ public class LeshanServerBuilder {
     public LeshanServer build() {
         if (localAddress == null)
             localAddress = new InetSocketAddress((InetAddress) null, PORT);
-        if (localAddressSecure == null)
-            localAddressSecure = new InetSocketAddress((InetAddress) null, PORT_DTLS);
+        if (localSecureAddress == null)
+            localSecureAddress = new InetSocketAddress((InetAddress) null, PORT_DTLS);
         if (clientRegistry == null)
             clientRegistry = new ClientRegistryImpl();
         if (securityRegistry == null)
@@ -103,7 +111,7 @@ public class LeshanServerBuilder {
         if (modelProvider == null) {
             modelProvider = new StandardModelProvider();
         }
-        return new LeshanServer(localAddress, localAddressSecure, clientRegistry, securityRegistry,
+        return new LeshanServer(localAddress, localSecureAddress, clientRegistry, securityRegistry,
                 observationRegistry, modelProvider);
     }
 }
diff --git a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/CaliforniumLwM2mRequestSender.java b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/CaliforniumLwM2mRequestSender.java
index 32ed5da8..7be355d2 100644
--- a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/CaliforniumLwM2mRequestSender.java
+++ b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/CaliforniumLwM2mRequestSender.java
@@ -64,7 +64,8 @@ public class CaliforniumLwM2mRequestSender implements LwM2mRequestSender {
     }
 
     @Override
-    public <T extends LwM2mResponse> T send(final Client destination, final DownlinkRequest<T> request, Long timeout) {
+    public <T extends LwM2mResponse> T send(final Client destination, final DownlinkRequest<T> request, Long timeout)
+            throws InterruptedException {
 
         // Retrieve the objects definition
         final LwM2mModel model = modelProvider.getObjectModel(destination);
@@ -248,7 +249,7 @@ public class CaliforniumLwM2mRequestSender implements LwM2mRequestSender {
             latch.countDown();
         }
 
-        public T waitForResponse() {
+        public T waitForResponse() throws InterruptedException {
             try {
                 boolean timeElapsed = false;
                 if (timeout != null) {
@@ -259,10 +260,6 @@ public class CaliforniumLwM2mRequestSender implements LwM2mRequestSender {
                 if (timeElapsed || coapTimeout.get()) {
                     coapRequest.cancel();
                 }
-            } catch (final InterruptedException e) {
-                // no idea why some other thread should have interrupted this thread
-                // but anyway, go ahead as if the timeout had been reached
-                LOG.debug("Caught an unexpected InterruptedException during execution of CoAP request", e);
             } finally {
                 coapRequest.removeMessageObserver(this);
             }
diff --git a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LeshanServer.java b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LeshanServer.java
index 08bc2f1f..2c919bf5 100644
--- a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LeshanServer.java
+++ b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LeshanServer.java
@@ -89,17 +89,17 @@ public class LeshanServer implements LwM2mServer {
      * Initialize a server which will bind to the specified address and port.
      *
      * @param localAddress the address to bind the CoAP server.
-     * @param localAddressSecure the address to bind the CoAP server for DTLS connection.
+     * @param localSecureAddress the address to bind the CoAP server for DTLS connection.
      * @param clientRegistry the registered {@link Client} registry.
      * @param securityRegistry the {@link SecurityInfo} registry.
      * @param observationRegistry the {@link Observation} registry.
      * @param modelProvider provides the objects description for each client.
      */
-    public LeshanServer(InetSocketAddress localAddress, InetSocketAddress localAddressSecure,
+    public LeshanServer(InetSocketAddress localAddress, InetSocketAddress localSecureAddress,
             final ClientRegistry clientRegistry, final SecurityRegistry securityRegistry,
             final ObservationRegistry observationRegistry, final LwM2mModelProvider modelProvider) {
         Validate.notNull(localAddress, "IP address cannot be null");
-        Validate.notNull(localAddressSecure, "Secure IP address cannot be null");
+        Validate.notNull(localSecureAddress, "Secure IP address cannot be null");
         Validate.notNull(clientRegistry, "clientRegistry cannot be null");
         Validate.notNull(securityRegistry, "securityRegistry cannot be null");
         Validate.notNull(observationRegistry, "observationRegistry cannot be null");
@@ -135,7 +135,7 @@ public class LeshanServer implements LwM2mServer {
         coapServer.addEndpoint(nonSecureEndpoint);
 
         // secure endpoint
-        Builder builder = new DtlsConnectorConfig.Builder(localAddressSecure);
+        Builder builder = new DtlsConnectorConfig.Builder(localSecureAddress);
         builder.setPskStore(new LwM2mPskStore(this.securityRegistry, this.clientRegistry));
         PrivateKey privateKey = this.securityRegistry.getServerPrivateKey();
         PublicKey publicKey = this.securityRegistry.getServerPublicKey();
@@ -183,7 +183,7 @@ public class LeshanServer implements LwM2mServer {
         // Start server
         coapServer.start();
 
-        LOG.info("LW-M2M server started");
+        LOG.info("LWM2M server started at coap://{}, coaps://{}.", getNonSecureAddress(), getSecureAddress());
     }
 
     @Override
@@ -202,7 +202,7 @@ public class LeshanServer implements LwM2mServer {
             ((Stoppable) observationRegistry).stop();
         }
 
-        LOG.info("LW-M2M server stopped");
+        LOG.info("LWM2M server stopped.");
     }
 
     public void destroy() {
@@ -220,7 +220,7 @@ public class LeshanServer implements LwM2mServer {
             ((Destroyable) observationRegistry).destroy();
         }
 
-        LOG.info("LW-M2M server destroyed");
+        LOG.info("LWM2M server destroyed.");
     }
 
     @Override
@@ -244,12 +244,14 @@ public class LeshanServer implements LwM2mServer {
     }
 
     @Override
-    public <T extends LwM2mResponse> T send(final Client destination, final DownlinkRequest<T> request) {
+    public <T extends LwM2mResponse> T send(final Client destination, final DownlinkRequest<T> request)
+            throws InterruptedException {
         return requestSender.send(destination, request, null);
     }
 
     @Override
-    public <T extends LwM2mResponse> T send(final Client destination, final DownlinkRequest<T> request, long timeout) {
+    public <T extends LwM2mResponse> T send(final Client destination, final DownlinkRequest<T> request, long timeout)
+            throws InterruptedException {
         return requestSender.send(destination, request, timeout);
     }
 
diff --git a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LwM2mBootstrapServerImpl.java b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LwM2mBootstrapServerImpl.java
index 9d3efd37..2ff2ff95 100644
--- a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LwM2mBootstrapServerImpl.java
+++ b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/LwM2mBootstrapServerImpl.java
@@ -96,7 +96,7 @@ public class LwM2mBootstrapServerImpl implements LwM2mBootstrapServer {
      */
     public void start() {
         coapServer.start();
-        LOG.info("LW-M2M server started");
+        LOG.info("Bootstrap server started at coap://{}, coaps://{}.", getNonSecureAddress(), getSecureAddress());
     }
 
     /**
@@ -104,6 +104,7 @@ public class LwM2mBootstrapServerImpl implements LwM2mBootstrapServer {
      */
     public void stop() {
         coapServer.stop();
+        LOG.info("Bootstrap server stopped.");
     }
 
     /**
@@ -111,6 +112,7 @@ public class LwM2mBootstrapServerImpl implements LwM2mBootstrapServer {
      */
     public void destroy() {
         coapServer.destroy();
+        LOG.info("Bootstrap server destroyed.");
     }
 
     public InetSocketAddress getNonSecureAddress() {
diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/LwM2mServer.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/LwM2mServer.java
index faf12be6..640f5106 100644
--- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/LwM2mServer.java
+++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/LwM2mServer.java
@@ -59,7 +59,7 @@ public interface LwM2mServer {
      * @return the response or <code>null</code> if the CoAP timeout expires ( see
      *         http://tools.ietf.org/html/rfc7252#section-4.2 ).
      */
-    <T extends LwM2mResponse> T send(Client destination, DownlinkRequest<T> request);
+    <T extends LwM2mResponse> T send(Client destination, DownlinkRequest<T> request) throws InterruptedException;
 
     /**
      * Sends a Lightweight M2M request synchronously. Will block until a response is received from the remote client.
@@ -69,7 +69,8 @@ public interface LwM2mServer {
      * @param timeout the request timeout in millisecond
      * @return the response or <code>null</code> if the timeout expires (given parameter or CoAP timeout).
      */
-    <T extends LwM2mResponse> T send(Client destination, DownlinkRequest<T> request, long timeout);
+    <T extends LwM2mResponse> T send(Client destination, DownlinkRequest<T> request, long timeout)
+            throws InterruptedException;
 
     /**
      * Sends a Lightweight M2M request asynchronously.
diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/request/LwM2mRequestSender.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/request/LwM2mRequestSender.java
index 177942b4..6a6f8ae7 100644
--- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/request/LwM2mRequestSender.java
+++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/request/LwM2mRequestSender.java
@@ -29,7 +29,8 @@ public interface LwM2mRequestSender {
      * @return the LWM2M response. The response can be <code>null</code> if the timeout (given parameter or CoAP
      *         timeout) expires.
      */
-    <T extends LwM2mResponse> T send(Client destination, DownlinkRequest<T> request, Long timeout);
+    <T extends LwM2mResponse> T send(Client destination, DownlinkRequest<T> request, Long timeout)
+            throws InterruptedException;
 
     /**
      * Send a Lightweight M2M request asynchronously.
diff --git a/leshan-standalone/pom.xml b/leshan-server-demo/pom.xml
similarity index 91%
rename from leshan-standalone/pom.xml
rename to leshan-server-demo/pom.xml
index 262ea0ea..9fb25215 100644
--- a/leshan-standalone/pom.xml
+++ b/leshan-server-demo/pom.xml
@@ -22,15 +22,19 @@ Contributors:
         <artifactId>leshan</artifactId>
         <version>0.1.11-M8-SNAPSHOT</version>
     </parent>
-    <artifactId>leshan-standalone</artifactId>
-    <name>leshan - standalone server</name>
-    <description>A LWM2M server running an embedded Jetty server</description>
+    <artifactId>leshan-server-demo</artifactId>
+    <name>leshan - server demo</name>
+    <description>A LWM2M demonstration server running an embedded Jetty server</description>
 
     <dependencies>
         <dependency>
             <groupId>org.eclipse.leshan</groupId>
             <artifactId>leshan-server-cf</artifactId>
         </dependency>
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.eclipse.californium</groupId>
             <artifactId>californium-core</artifactId>
@@ -81,7 +85,7 @@ Contributors:
                 <configuration>
                     <archive>
                         <manifest>
-                            <mainClass>org.eclipse.leshan.standalone.LeshanStandalone</mainClass>
+                            <mainClass>org.eclipse.leshan.server.demo.LeshanServerDemo</mainClass>
                         </manifest>
                     </archive>
                     <descriptorRefs>
diff --git a/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/LeshanServerDemo.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/LeshanServerDemo.java
new file mode 100644
index 00000000..8edd7426
--- /dev/null
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/LeshanServerDemo.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2015 Sierra Wireless and others.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ * 
+ * The Eclipse Public License is available at
+ *    http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ *    http://www.eclipse.org/org/documents/edl-v10.html.
+ * 
+ * Contributors:
+ *     Sierra Wireless - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.leshan.server.demo;
+
+import java.math.BigInteger;
+import java.net.BindException;
+import java.security.AlgorithmParameters;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.ECGenParameterSpec;
+import java.security.spec.ECParameterSpec;
+import java.security.spec.ECPoint;
+import java.security.spec.ECPrivateKeySpec;
+import java.security.spec.ECPublicKeySpec;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.InvalidParameterSpecException;
+import java.security.spec.KeySpec;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.leshan.server.californium.LeshanServerBuilder;
+import org.eclipse.leshan.server.californium.impl.LeshanServer;
+import org.eclipse.leshan.server.demo.servlet.ClientServlet;
+import org.eclipse.leshan.server.demo.servlet.EventServlet;
+import org.eclipse.leshan.server.demo.servlet.ObjectSpecServlet;
+import org.eclipse.leshan.server.demo.servlet.SecurityServlet;
+import org.eclipse.leshan.server.impl.SecurityRegistryImpl;
+import org.eclipse.leshan.util.Hex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LeshanServerDemo {
+
+    private static final Logger LOG = LoggerFactory.getLogger(LeshanServerDemo.class);
+
+    private final static String USAGE = "java -jar leshan-server-demo.jar [OPTION]";
+    private final static String FOOTER = "All options could be passed using environment variables.(using long option name in uppercase)";
+
+    public static void main(String[] args) {
+        // Define options for command line tools
+        Options options = new Options();
+
+        options.addOption("h", "help", false, "Display help information.");
+        options.addOption("lh", "coaphost", true, "Set the local CoAP address.\n  Default: any local address.");
+        options.addOption("lp", "coapport", true, "Set the local CoAP port.\n  Default: 5683.");
+        options.addOption("slh", "coapshost", true, "Set the secure local CoAP address.\nDefault: any local address.");
+        options.addOption("slp", "coapsport", true, "Set the secure local CoAP port.\nDefault: 5684.");
+        options.addOption("wp", "webport", true, "Set the HTTP port for web server.\nDefault: 8080.");
+        HelpFormatter formatter = new HelpFormatter();
+        formatter.setOptionComparator(null);
+
+        // Parse arguments
+        CommandLine cl = null;
+        try {
+            cl = new DefaultParser().parse(options, args);
+        } catch (ParseException e) {
+            System.err.println("Parsing failed.  Reason: " + e.getMessage());
+            formatter.printHelp(USAGE, null, options, FOOTER);
+            return;
+        }
+
+        // Print help
+        if (cl.hasOption("help")) {
+            formatter.printHelp(USAGE, null, options, FOOTER);
+            return;
+        }
+
+        // Abort if unexpected options
+        if (cl.getArgs().length > 0) {
+            System.out.println("Unexpected option or arguments : " + cl.getArgList());
+            formatter.printHelp(USAGE, null, options, FOOTER);
+            return;
+        }
+
+        // get local address
+        String localAddress = System.getenv("COAPHOST");
+        if (cl.hasOption("lh")) {
+            localAddress = cl.getOptionValue("lh");
+        }
+        String localPortOption = System.getenv("COAPPORT");
+        if (cl.hasOption("lp")) {
+            localPortOption = cl.getOptionValue("lp");
+        }
+        int localPort = LeshanServerBuilder.PORT;
+        if (localPortOption != null) {
+            localPort = Integer.parseInt(localPortOption);
+        }
+
+        // get secure local address
+        String secureLocalAddress = System.getenv("COAPSHOST");
+        if (cl.hasOption("slh")) {
+            secureLocalAddress = cl.getOptionValue("slh");
+        }
+        String secureLocalPortOption = System.getenv("COAPSPORT");
+        if (cl.hasOption("slp")) {
+            secureLocalPortOption = cl.getOptionValue("slp");
+        }
+        int secureLocalPort = LeshanServerBuilder.PORT_DTLS;
+        if (secureLocalPortOption != null) {
+            secureLocalPort = Integer.parseInt(secureLocalPortOption);
+        }
+
+        // get http port
+        String webPortOption = System.getenv("WEBPORT");
+        if (cl.hasOption("wp")) {
+            webPortOption = cl.getOptionValue("wp");
+        }
+        int webPort = 8080;
+        if (webPortOption != null) {
+            webPort = Integer.parseInt(webPortOption);
+        }
+
+        try {
+            createAndStartServer(webPort, localAddress, localPort, secureLocalAddress, secureLocalPort);
+        } catch (BindException e) {
+            System.out.println(String.format("Web port %s is alreay used, you could change it using 'webport' option.",
+                    webPort));
+            formatter.printHelp(USAGE, null, options, FOOTER);
+        } catch (Exception e) {
+            LOG.error("Jetty stopped with unexcepted error ...", e);
+        }
+    }
+
+    public static void createAndStartServer(int webPort, String localAddress, int localPort, String secureLocalAddress,
+            int secureLocalPort) throws Exception {
+        // Prepare LWM2M server
+        LeshanServerBuilder builder = new LeshanServerBuilder();
+        builder.setLocalAddress(localAddress, localPort);
+        builder.setLocalSecureAddress(secureLocalAddress, secureLocalPort);
+
+        // Get public and private server key
+        PrivateKey privateKey = null;
+        PublicKey publicKey = null;
+        try {
+            // Get point values
+            byte[] publicX = Hex.decodeHex("fcc28728c123b155be410fc1c0651da374fc6ebe7f96606e90d927d188894a73"
+                    .toCharArray());
+            byte[] publicY = Hex.decodeHex("d2ffaa73957d76984633fc1cc54d0b763ca0559a9dff9706e9f4557dacc3f52a"
+                    .toCharArray());
+            byte[] privateS = Hex.decodeHex("1dae121ba406802ef07c193c1ee4df91115aabd79c1ed7f4c0ef7ef6a5449400"
+                    .toCharArray());
+
+            // Get Elliptic Curve Parameter spec for secp256r1
+            AlgorithmParameters algoParameters = AlgorithmParameters.getInstance("EC");
+            algoParameters.init(new ECGenParameterSpec("secp256r1"));
+            ECParameterSpec parameterSpec = algoParameters.getParameterSpec(ECParameterSpec.class);
+
+            // Create key specs
+            KeySpec publicKeySpec = new ECPublicKeySpec(new ECPoint(new BigInteger(publicX), new BigInteger(publicY)),
+                    parameterSpec);
+            KeySpec privateKeySpec = new ECPrivateKeySpec(new BigInteger(privateS), parameterSpec);
+
+            // Get keys
+            publicKey = KeyFactory.getInstance("EC").generatePublic(publicKeySpec);
+            privateKey = KeyFactory.getInstance("EC").generatePrivate(privateKeySpec);
+
+            builder.setSecurityRegistry(new SecurityRegistryImpl(privateKey, publicKey));
+        } catch (InvalidKeySpecException | NoSuchAlgorithmException | InvalidParameterSpecException e) {
+            LOG.warn("Unable to load RPK.", e);
+        }
+
+        // Create and start LWM2M server
+        LeshanServer lwServer = builder.build();
+        lwServer.start();
+
+        // Now prepare Jetty
+        Server server = new Server(webPort);
+        WebAppContext root = new WebAppContext();
+        root.setContextPath("/");
+        root.setResourceBase(LeshanServerDemo.class.getClassLoader().getResource("webapp").toExternalForm());
+        root.setParentLoaderPriority(true);
+        server.setHandler(root);
+
+        // Create Servlet
+        EventServlet eventServlet = new EventServlet(lwServer, lwServer.getSecureAddress().getPort());
+        ServletHolder eventServletHolder = new ServletHolder(eventServlet);
+        root.addServlet(eventServletHolder, "/event/*");
+
+        ServletHolder clientServletHolder = new ServletHolder(new ClientServlet(lwServer, lwServer.getSecureAddress()
+                .getPort()));
+        root.addServlet(clientServletHolder, "/api/clients/*");
+
+        ServletHolder securityServletHolder = new ServletHolder(new SecurityServlet(lwServer.getSecurityRegistry()));
+        root.addServlet(securityServletHolder, "/api/security/*");
+
+        ServletHolder objectSpecServletHolder = new ServletHolder(new ObjectSpecServlet(lwServer.getModelProvider()));
+        root.addServlet(objectSpecServletHolder, "/api/objectspecs/*");
+
+        // Start Jetty
+        server.start();
+        LOG.info("Web server started at {}.", server.getURI());
+    }
+}
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/ClientServlet.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ClientServlet.java
similarity index 91%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/ClientServlet.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ClientServlet.java
index 3917ec33..84608242 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/ClientServlet.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ClientServlet.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet;
+package org.eclipse.leshan.server.demo.servlet;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -50,10 +50,10 @@ import org.eclipse.leshan.core.response.ReadResponse;
 import org.eclipse.leshan.core.response.WriteResponse;
 import org.eclipse.leshan.server.LwM2mServer;
 import org.eclipse.leshan.server.client.Client;
-import org.eclipse.leshan.standalone.servlet.json.ClientSerializer;
-import org.eclipse.leshan.standalone.servlet.json.LwM2mNodeDeserializer;
-import org.eclipse.leshan.standalone.servlet.json.LwM2mNodeSerializer;
-import org.eclipse.leshan.standalone.servlet.json.ResponseSerializer;
+import org.eclipse.leshan.server.demo.servlet.json.ClientSerializer;
+import org.eclipse.leshan.server.demo.servlet.json.LwM2mNodeDeserializer;
+import org.eclipse.leshan.server.demo.servlet.json.LwM2mNodeSerializer;
+import org.eclipse.leshan.server.demo.servlet.json.ResponseSerializer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -146,6 +146,10 @@ public class ClientServlet extends HttpServlet {
             LOG.warn(String.format("Error accessing resource %s%s.", req.getServletPath(), req.getPathInfo()), e);
             resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             resp.getWriter().append(e.getMessage()).flush();
+        } catch (InterruptedException e) {
+            LOG.warn("Thread Interrupted", e);
+            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            resp.getWriter().append(e.getMessage()).flush();
         }
     }
 
@@ -181,6 +185,10 @@ public class ClientServlet extends HttpServlet {
             LOG.warn(String.format("Error accessing resource %s%s.", req.getServletPath(), req.getPathInfo()), e);
             resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             resp.getWriter().append(e.getMessage()).flush();
+        } catch (InterruptedException e) {
+            LOG.warn("Thread Interrupted", e);
+            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            resp.getWriter().append(e.getMessage()).flush();
         }
     }
 
@@ -213,6 +221,10 @@ public class ClientServlet extends HttpServlet {
                 LOG.warn(String.format("Error accessing resource %s%s.", req.getServletPath(), req.getPathInfo()), e);
                 resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                 resp.getWriter().append(e.getMessage()).flush();
+            } catch (InterruptedException e) {
+                LOG.warn("Thread Interrupted", e);
+                resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                resp.getWriter().append(e.getMessage()).flush();
             }
             return;
         }
@@ -239,6 +251,10 @@ public class ClientServlet extends HttpServlet {
                 LOG.warn(String.format("Error accessing resource %s%s.", req.getServletPath(), req.getPathInfo()), e);
                 resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                 resp.getWriter().append(e.getMessage()).flush();
+            } catch (InterruptedException e) {
+                LOG.warn("Thread Interrupted", e);
+                resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                resp.getWriter().append(e.getMessage()).flush();
             }
             return;
         }
@@ -262,6 +278,10 @@ public class ClientServlet extends HttpServlet {
                 LOG.warn(String.format("Error accessing resource %s%s.", req.getServletPath(), req.getPathInfo()), e);
                 resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                 resp.getWriter().append(e.getMessage()).flush();
+            } catch (InterruptedException e) {
+                LOG.warn("Thread Interrupted", e);
+                resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                resp.getWriter().append(e.getMessage()).flush();
             }
             return;
         }
@@ -316,6 +336,10 @@ public class ClientServlet extends HttpServlet {
             LOG.warn(String.format("Error accessing resource %s%s.", req.getServletPath(), req.getPathInfo()), e);
             resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             resp.getWriter().append(e.getMessage()).flush();
+        } catch (InterruptedException e) {
+            LOG.warn("Interrupted request", e);
+            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            resp.getWriter().append(e.getMessage()).flush();
         }
     }
 
@@ -337,7 +361,7 @@ public class ClientServlet extends HttpServlet {
 
     // TODO refactor the code to remove this method.
     private WriteResponse writeRequest(Client client, String target, HttpServletRequest req, HttpServletResponse resp)
-            throws IOException {
+            throws IOException, InterruptedException {
         Map<String, String> parameters = new HashMap<String, String>();
         String contentType = HttpFields.valueParameters(req.getContentType(), parameters);
 
@@ -366,7 +390,7 @@ public class ClientServlet extends HttpServlet {
 
     // TODO refactor the code to remove this method.
     private CreateResponse createRequest(Client client, String target, HttpServletRequest req, HttpServletResponse resp)
-            throws IOException {
+            throws IOException, InterruptedException {
         Map<String, String> parameters = new HashMap<String, String>();
         String contentType = HttpFields.valueParameters(req.getContentType(), parameters);
         if ("application/json".equals(contentType)) {
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/EventServlet.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/EventServlet.java
similarity index 93%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/EventServlet.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/EventServlet.java
index e2367154..55b35807 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/EventServlet.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/EventServlet.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet;
+package org.eclipse.leshan.server.demo.servlet;
 
 import java.io.IOException;
 import java.util.Set;
@@ -27,14 +27,14 @@ import org.eclipse.leshan.core.observation.Observation;
 import org.eclipse.leshan.server.californium.impl.LeshanServer;
 import org.eclipse.leshan.server.client.Client;
 import org.eclipse.leshan.server.client.ClientRegistryListener;
+import org.eclipse.leshan.server.demo.servlet.json.ClientSerializer;
+import org.eclipse.leshan.server.demo.servlet.json.LwM2mNodeSerializer;
+import org.eclipse.leshan.server.demo.servlet.log.CoapMessage;
+import org.eclipse.leshan.server.demo.servlet.log.CoapMessageListener;
+import org.eclipse.leshan.server.demo.servlet.log.CoapMessageTracer;
+import org.eclipse.leshan.server.demo.utils.EventSource;
+import org.eclipse.leshan.server.demo.utils.EventSourceServlet;
 import org.eclipse.leshan.server.observation.ObservationRegistryListener;
-import org.eclipse.leshan.standalone.servlet.json.ClientSerializer;
-import org.eclipse.leshan.standalone.servlet.json.LwM2mNodeSerializer;
-import org.eclipse.leshan.standalone.servlet.log.CoapMessage;
-import org.eclipse.leshan.standalone.servlet.log.CoapMessageListener;
-import org.eclipse.leshan.standalone.servlet.log.CoapMessageTracer;
-import org.eclipse.leshan.standalone.utils.EventSource;
-import org.eclipse.leshan.standalone.utils.EventSourceServlet;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/ObjectSpecServlet.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ObjectSpecServlet.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/ObjectSpecServlet.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ObjectSpecServlet.java
index f426df04..57a0dd2e 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/ObjectSpecServlet.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ObjectSpecServlet.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet;
+package org.eclipse.leshan.server.demo.servlet;
 
 import java.io.IOException;
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/SecurityServlet.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/SecurityServlet.java
similarity index 96%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/SecurityServlet.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/SecurityServlet.java
index 3967a787..621e974e 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/SecurityServlet.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/SecurityServlet.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet;
+package org.eclipse.leshan.server.demo.servlet;
 
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -26,11 +26,11 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang.StringUtils;
+import org.eclipse.leshan.server.demo.servlet.json.SecurityDeserializer;
+import org.eclipse.leshan.server.demo.servlet.json.SecuritySerializer;
 import org.eclipse.leshan.server.security.NonUniqueSecurityInfoException;
 import org.eclipse.leshan.server.security.SecurityInfo;
 import org.eclipse.leshan.server.security.SecurityRegistry;
-import org.eclipse.leshan.standalone.servlet.json.SecurityDeserializer;
-import org.eclipse.leshan.standalone.servlet.json.SecuritySerializer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/ClientSerializer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/ClientSerializer.java
similarity index 97%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/ClientSerializer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/ClientSerializer.java
index 37e9ba22..3ea887bd 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/ClientSerializer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/ClientSerializer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.json;
+package org.eclipse.leshan.server.demo.servlet.json;
 
 import java.lang.reflect.Type;
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/LwM2mNodeDeserializer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/LwM2mNodeDeserializer.java
similarity index 99%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/LwM2mNodeDeserializer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/LwM2mNodeDeserializer.java
index a6d51222..6a6aff6b 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/LwM2mNodeDeserializer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/LwM2mNodeDeserializer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.json;
+package org.eclipse.leshan.server.demo.servlet.json;
 
 import java.lang.reflect.Type;
 import java.util.HashMap;
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/LwM2mNodeSerializer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/LwM2mNodeSerializer.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/LwM2mNodeSerializer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/LwM2mNodeSerializer.java
index 7f197fce..bb97c9df 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/LwM2mNodeSerializer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/LwM2mNodeSerializer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.json;
+package org.eclipse.leshan.server.demo.servlet.json;
 
 import java.lang.reflect.Type;
 import java.util.Map.Entry;
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/ResponseSerializer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/ResponseSerializer.java
similarity index 96%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/ResponseSerializer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/ResponseSerializer.java
index b20d54e7..d3f7d456 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/ResponseSerializer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/ResponseSerializer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.json;
+package org.eclipse.leshan.server.demo.servlet.json;
 
 import java.lang.reflect.Type;
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/SecurityDeserializer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/SecurityDeserializer.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/SecurityDeserializer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/SecurityDeserializer.java
index de8e8e99..d5e65c3c 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/SecurityDeserializer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/SecurityDeserializer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.json;
+package org.eclipse.leshan.server.demo.servlet.json;
 
 import java.lang.reflect.Type;
 import java.math.BigInteger;
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/SecuritySerializer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/SecuritySerializer.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/SecuritySerializer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/SecuritySerializer.java
index f85ef43c..a37c0b15 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/json/SecuritySerializer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/json/SecuritySerializer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.json;
+package org.eclipse.leshan.server.demo.servlet.json;
 
 import java.lang.reflect.Type;
 import java.security.PublicKey;
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessage.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessage.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java
index 821563dd..10c74fb0 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessage.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.log;
+package org.eclipse.leshan.server.demo.servlet.log;
 
 import java.util.ArrayList;
 import java.util.HashMap;
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessageListener.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessageListener.java
similarity index 93%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessageListener.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessageListener.java
index 125753c6..76d3b0fa 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessageListener.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessageListener.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.log;
+package org.eclipse.leshan.server.demo.servlet.log;
 
 public interface CoapMessageListener {
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessageTracer.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessageTracer.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessageTracer.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessageTracer.java
index 128ed7e6..6ca5484a 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/servlet/log/CoapMessageTracer.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessageTracer.java
@@ -13,7 +13,7 @@
  * Contributors:
  *     Sierra Wireless - initial API and implementation
  *******************************************************************************/
-package org.eclipse.leshan.standalone.servlet.log;
+package org.eclipse.leshan.server.demo.servlet.log;
 
 import java.net.InetAddress;
 import java.util.Map;
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/utils/EventSource.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/utils/EventSource.java
similarity index 98%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/utils/EventSource.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/utils/EventSource.java
index 9a857967..61eed30b 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/utils/EventSource.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/utils/EventSource.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.eclipse.leshan.standalone.utils;
+package org.eclipse.leshan.server.demo.utils;
 
 import java.io.IOException;
 
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/utils/EventSourceServlet.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/utils/EventSourceServlet.java
similarity index 99%
rename from leshan-standalone/src/main/java/org/eclipse/leshan/standalone/utils/EventSourceServlet.java
rename to leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/utils/EventSourceServlet.java
index 0eb664b5..21e0d882 100644
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/utils/EventSourceServlet.java
+++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/utils/EventSourceServlet.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.eclipse.leshan.standalone.utils;
+package org.eclipse.leshan.server.demo.utils;
 
 import java.io.BufferedReader;
 import java.io.IOException;
diff --git a/leshan-client-example/src/main/resources/log4j2.xml b/leshan-server-demo/src/main/resources/log4j2.xml
similarity index 92%
rename from leshan-client-example/src/main/resources/log4j2.xml
rename to leshan-server-demo/src/main/resources/log4j2.xml
index 6b56a6b6..876aa3fb 100644
--- a/leshan-client-example/src/main/resources/log4j2.xml
+++ b/leshan-server-demo/src/main/resources/log4j2.xml
@@ -21,7 +21,7 @@ Contributors:
 
   <Appenders>
     <Appender type="Console" name="STDOUT">
-      <Layout type="PatternLayout" pattern="%d %p %C{1.} [%t] %m%n"/>
+      <Layout type="PatternLayout" pattern="[%d %p %C{0}] %m%n"/>
     </Appender>
   </Appenders>
  
diff --git a/leshan-standalone/src/main/resources/webapp/css/lw-app.css b/leshan-server-demo/src/main/resources/webapp/css/lw-app.css
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/css/lw-app.css
rename to leshan-server-demo/src/main/resources/webapp/css/lw-app.css
diff --git a/leshan-standalone/src/main/resources/webapp/img/fav_icon.png b/leshan-server-demo/src/main/resources/webapp/img/fav_icon.png
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/img/fav_icon.png
rename to leshan-server-demo/src/main/resources/webapp/img/fav_icon.png
diff --git a/leshan-standalone/src/main/resources/webapp/img/logo.png b/leshan-server-demo/src/main/resources/webapp/img/logo.png
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/img/logo.png
rename to leshan-server-demo/src/main/resources/webapp/img/logo.png
diff --git a/leshan-standalone/src/main/resources/webapp/index.html b/leshan-server-demo/src/main/resources/webapp/index.html
similarity index 98%
rename from leshan-standalone/src/main/resources/webapp/index.html
rename to leshan-server-demo/src/main/resources/webapp/index.html
index a732f76b..dfb4983d 100644
--- a/leshan-standalone/src/main/resources/webapp/index.html
+++ b/leshan-server-demo/src/main/resources/webapp/index.html
@@ -2,7 +2,7 @@
 <html lang="en" ng-app="leshanApp">
 <head>
     <meta charset="utf-8">
-    <title>Lightweight M2M clients</title>
+    <title>leshan Server Demo</title>
 
     <link rel="stylesheet" href="vendor/css/bootstrap.min.css">
     <link rel="stylesheet" href="css/lw-app.css" />
diff --git a/leshan-standalone/src/main/resources/webapp/js/app.js b/leshan-server-demo/src/main/resources/webapp/js/app.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/app.js
rename to leshan-server-demo/src/main/resources/webapp/js/app.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/client-controllers.js b/leshan-server-demo/src/main/resources/webapp/js/client-controllers.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/client-controllers.js
rename to leshan-server-demo/src/main/resources/webapp/js/client-controllers.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/instance-directives.js b/leshan-server-demo/src/main/resources/webapp/js/instance-directives.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/instance-directives.js
rename to leshan-server-demo/src/main/resources/webapp/js/instance-directives.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/lw-resources-services.js b/leshan-server-demo/src/main/resources/webapp/js/lw-resources-services.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/lw-resources-services.js
rename to leshan-server-demo/src/main/resources/webapp/js/lw-resources-services.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/modal-instance-controllers.js b/leshan-server-demo/src/main/resources/webapp/js/modal-instance-controllers.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/modal-instance-controllers.js
rename to leshan-server-demo/src/main/resources/webapp/js/modal-instance-controllers.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/object-directives.js b/leshan-server-demo/src/main/resources/webapp/js/object-directives.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/object-directives.js
rename to leshan-server-demo/src/main/resources/webapp/js/object-directives.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/resource-directives.js b/leshan-server-demo/src/main/resources/webapp/js/resource-directives.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/resource-directives.js
rename to leshan-server-demo/src/main/resources/webapp/js/resource-directives.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/resource-form-directives.js b/leshan-server-demo/src/main/resources/webapp/js/resource-form-directives.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/resource-form-directives.js
rename to leshan-server-demo/src/main/resources/webapp/js/resource-form-directives.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/security-controllers.js b/leshan-server-demo/src/main/resources/webapp/js/security-controllers.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/security-controllers.js
rename to leshan-server-demo/src/main/resources/webapp/js/security-controllers.js
diff --git a/leshan-standalone/src/main/resources/webapp/js/ui-dialog-services.js b/leshan-server-demo/src/main/resources/webapp/js/ui-dialog-services.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/js/ui-dialog-services.js
rename to leshan-server-demo/src/main/resources/webapp/js/ui-dialog-services.js
diff --git a/leshan-standalone/src/main/resources/webapp/partials/client-detail.html b/leshan-server-demo/src/main/resources/webapp/partials/client-detail.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/client-detail.html
rename to leshan-server-demo/src/main/resources/webapp/partials/client-detail.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/client-list.html b/leshan-server-demo/src/main/resources/webapp/partials/client-list.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/client-list.html
rename to leshan-server-demo/src/main/resources/webapp/partials/client-list.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/instance.html b/leshan-server-demo/src/main/resources/webapp/partials/instance.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/instance.html
rename to leshan-server-demo/src/main/resources/webapp/partials/instance.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/modal-instance.html b/leshan-server-demo/src/main/resources/webapp/partials/modal-instance.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/modal-instance.html
rename to leshan-server-demo/src/main/resources/webapp/partials/modal-instance.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/object.html b/leshan-server-demo/src/main/resources/webapp/partials/object.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/object.html
rename to leshan-server-demo/src/main/resources/webapp/partials/object.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/resource-form.html b/leshan-server-demo/src/main/resources/webapp/partials/resource-form.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/resource-form.html
rename to leshan-server-demo/src/main/resources/webapp/partials/resource-form.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/resource.html b/leshan-server-demo/src/main/resources/webapp/partials/resource.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/resource.html
rename to leshan-server-demo/src/main/resources/webapp/partials/resource.html
diff --git a/leshan-standalone/src/main/resources/webapp/partials/security-list.html b/leshan-server-demo/src/main/resources/webapp/partials/security-list.html
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/partials/security-list.html
rename to leshan-server-demo/src/main/resources/webapp/partials/security-list.html
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap-theme.css b/leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap-theme.css
rename to leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map b/leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map
rename to leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.css.map
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css b/leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css
rename to leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap-theme.min.css
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap.css b/leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap.css
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap.css
rename to leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap.css
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap.css.map b/leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap.css.map
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap.css.map
rename to leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap.css.map
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap.min.css b/leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap.min.css
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/css/bootstrap.min.css
rename to leshan-server-demo/src/main/resources/webapp/vendor/css/bootstrap.min.css
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot b/leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot
rename to leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.eot
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg b/leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg
rename to leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.svg
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf b/leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf
rename to leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.ttf
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff b/leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff
rename to leshan-server-demo/src/main/resources/webapp/vendor/fonts/glyphicons-halflings-regular.woff
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/angular-route.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/angular-route.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/angular-route.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/angular-route.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/angular-route.min.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/angular-route.min.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/angular-route.min.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/angular-route.min.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/angular-route.min.js.map b/leshan-server-demo/src/main/resources/webapp/vendor/js/angular-route.min.js.map
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/angular-route.min.js.map
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/angular-route.min.js.map
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/angular.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/angular.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/angular.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/angular.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/angular.min.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/angular.min.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/angular.min.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/angular.min.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/angular.min.js.map b/leshan-server-demo/src/main/resources/webapp/vendor/js/angular.min.js.map
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/angular.min.js.map
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/angular.min.js.map
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/bootstrap.min.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/bootstrap.min.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/bootstrap.min.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/bootstrap.min.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/jquery-2.1.1.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/jquery-2.1.1.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map b/leshan-server-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/jquery-2.1.1.min.map
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.js
diff --git a/leshan-standalone/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.min.js b/leshan-server-demo/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.min.js
similarity index 100%
rename from leshan-standalone/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.min.js
rename to leshan-server-demo/src/main/resources/webapp/vendor/js/ui-bootstrap-tpls-0.12.1.min.js
diff --git a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/LeshanStandalone.java b/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/LeshanStandalone.java
deleted file mode 100644
index 21aba94a..00000000
--- a/leshan-standalone/src/main/java/org/eclipse/leshan/standalone/LeshanStandalone.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013-2015 Sierra Wireless and others.
- * 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Eclipse Distribution License v1.0 which accompany this distribution.
- * 
- * The Eclipse Public License is available at
- *    http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- *    http://www.eclipse.org/org/documents/edl-v10.html.
- * 
- * Contributors:
- *     Sierra Wireless - initial API and implementation
- *******************************************************************************/
-package org.eclipse.leshan.standalone;
-
-import java.math.BigInteger;
-import java.security.AlgorithmParameters;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.spec.ECGenParameterSpec;
-import java.security.spec.ECParameterSpec;
-import java.security.spec.ECPoint;
-import java.security.spec.ECPrivateKeySpec;
-import java.security.spec.ECPublicKeySpec;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.InvalidParameterSpecException;
-import java.security.spec.KeySpec;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.leshan.server.californium.LeshanServerBuilder;
-import org.eclipse.leshan.server.californium.impl.LeshanServer;
-import org.eclipse.leshan.server.impl.SecurityRegistryImpl;
-import org.eclipse.leshan.standalone.servlet.ClientServlet;
-import org.eclipse.leshan.standalone.servlet.EventServlet;
-import org.eclipse.leshan.standalone.servlet.ObjectSpecServlet;
-import org.eclipse.leshan.standalone.servlet.SecurityServlet;
-import org.eclipse.leshan.util.Hex;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LeshanStandalone {
-
-    private static final Logger LOG = LoggerFactory.getLogger(LeshanStandalone.class);
-
-    private Server server;
-    private LeshanServer lwServer;
-
-    public void start() {
-        // Use those ENV variables for specifying the interface to be bound for coap and coaps
-        String iface = System.getenv("COAPIFACE");
-        String ifaces = System.getenv("COAPSIFACE");
-
-        // Build LWM2M server
-        LeshanServerBuilder builder = new LeshanServerBuilder();
-        if (iface != null && !iface.isEmpty()) {
-            builder.setLocalAddress(iface.substring(0, iface.lastIndexOf(':')),
-                Integer.parseInt(iface.substring(iface.lastIndexOf(':') + 1, iface.length())));
-        }
-        if (ifaces != null && !ifaces.isEmpty()) {
-            builder.setLocalAddressSecure(ifaces.substring(0, ifaces.lastIndexOf(':')),
-                Integer.parseInt(ifaces.substring(ifaces.lastIndexOf(':') + 1, ifaces.length())));
-        }
-
-        // Get public and private server key
-        PrivateKey privateKey = null;
-        PublicKey publicKey = null;
-        try {
-            // Get point values
-            byte[] publicX = Hex
-                    .decodeHex("fcc28728c123b155be410fc1c0651da374fc6ebe7f96606e90d927d188894a73".toCharArray());
-            byte[] publicY = Hex
-                    .decodeHex("d2ffaa73957d76984633fc1cc54d0b763ca0559a9dff9706e9f4557dacc3f52a".toCharArray());
-            byte[] privateS = Hex
-                    .decodeHex("1dae121ba406802ef07c193c1ee4df91115aabd79c1ed7f4c0ef7ef6a5449400".toCharArray());
-
-            // Get Elliptic Curve Parameter spec for secp256r1
-            AlgorithmParameters algoParameters = AlgorithmParameters.getInstance("EC");
-            algoParameters.init(new ECGenParameterSpec("secp256r1"));
-            ECParameterSpec parameterSpec = algoParameters.getParameterSpec(ECParameterSpec.class);
-
-            // Create key specs
-            KeySpec publicKeySpec = new ECPublicKeySpec(new ECPoint(new BigInteger(publicX), new BigInteger(publicY)),
-                    parameterSpec);
-            KeySpec privateKeySpec = new ECPrivateKeySpec(new BigInteger(privateS), parameterSpec);
-
-            // Get keys
-            publicKey = KeyFactory.getInstance("EC").generatePublic(publicKeySpec);
-            privateKey = KeyFactory.getInstance("EC").generatePrivate(privateKeySpec);
-
-            builder.setSecurityRegistry(new SecurityRegistryImpl(privateKey, publicKey));
-        } catch (InvalidKeySpecException | NoSuchAlgorithmException | InvalidParameterSpecException e) {
-            LOG.warn("Unable to load RPK.", e);
-        }
-
-        lwServer = builder.build();
-        lwServer.start();
-
-        // Now prepare and start jetty
-        String webPort = System.getenv("PORT");
-        if (webPort == null || webPort.isEmpty()) {
-            webPort = System.getProperty("PORT");
-        }
-        if (webPort == null || webPort.isEmpty()) {
-            webPort = "8080";
-        }
-        server = new Server(Integer.valueOf(webPort));
-        WebAppContext root = new WebAppContext();
-        root.setContextPath("/");
-        root.setResourceBase(this.getClass().getClassLoader().getResource("webapp").toExternalForm());
-        root.setParentLoaderPriority(true);
-        server.setHandler(root);
-
-        // Create Servlet
-        EventServlet eventServlet = new EventServlet(lwServer, lwServer.getSecureAddress().getPort());
-        ServletHolder eventServletHolder = new ServletHolder(eventServlet);
-        root.addServlet(eventServletHolder, "/event/*");
-
-        ServletHolder clientServletHolder = new ServletHolder(new ClientServlet(lwServer, lwServer.getSecureAddress()
-                .getPort()));
-        root.addServlet(clientServletHolder, "/api/clients/*");
-
-        ServletHolder securityServletHolder = new ServletHolder(new SecurityServlet(lwServer.getSecurityRegistry()));
-        root.addServlet(securityServletHolder, "/api/security/*");
-
-        ServletHolder objectSpecServletHolder = new ServletHolder(new ObjectSpecServlet(lwServer.getModelProvider()));
-        root.addServlet(objectSpecServletHolder, "/api/objectspecs/*");
-
-        // Start jetty
-        try {
-            server.start();
-        } catch (Exception e) {
-            LOG.error("jetty error", e);
-        }
-    }
-
-    public void stop() {
-        try {
-            lwServer.destroy();
-            server.stop();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public static void main(String[] args) {
-        new LeshanStandalone().start();
-    }
-}
diff --git a/pom.xml b/pom.xml
index 062a1431..8edc0672 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,9 +48,9 @@ Contributors:
 
         <module>leshan-integration-tests</module> 
 
-        <module>leshan-client-example</module>
-        <module>leshan-standalone</module>
-        <module>leshan-bs-server</module>
+        <module>leshan-server-demo</module>
+        <module>leshan-client-demo</module>
+        <module>leshan-bsserver-demo</module>
     </modules>
 
     <scm>


Test patch:
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/CreateTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/CreateTest.java
index d0968819..c701d29b 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/CreateTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/CreateTest.java
@@ -51,7 +51,7 @@ public class CreateTest {
     }
 
     @Test
-    public void can_create_instance_of_object() {
+    public void can_create_instance_of_object() throws InterruptedException {
         // create ACL instance
         CreateResponse response = helper.server.send(helper.getClient(), new CreateRequest(2, 0, new LwM2mResource[0]));
 
@@ -61,7 +61,7 @@ public class CreateTest {
     }
 
     @Test
-    public void can_create_instance_of_object_without_instance_id() {
+    public void can_create_instance_of_object_without_instance_id() throws InterruptedException {
         // create ACL instance
         CreateResponse response = helper.server.send(helper.getClient(), new CreateRequest(2, new LwM2mResource[0]));
 
@@ -79,7 +79,7 @@ public class CreateTest {
     }
 
     @Test
-    public void can_create_specific_instance_of_object() {
+    public void can_create_specific_instance_of_object() throws InterruptedException {
         // create ACL instance
         LwM2mResource accessControlOwner = LwM2mSingleResource.newIntegerResource(3, 123);
         CreateResponse response = helper.server.send(helper.getClient(), new CreateRequest(2, 0, accessControlOwner));
@@ -90,7 +90,7 @@ public class CreateTest {
     }
 
     @Test
-    public void can_create_specific_instance_of_object_with_json() {
+    public void can_create_specific_instance_of_object_with_json() throws InterruptedException {
         // create ACL instance
         LwM2mResource accessControlOwner = LwM2mSingleResource.newIntegerResource(3, 123);
         CreateResponse response = helper.server.send(helper.getClient(), new CreateRequest(ContentFormat.JSON, 2, 0,
@@ -102,7 +102,7 @@ public class CreateTest {
     }
 
     @Test
-    public void cannot_create_instance_of_object() {
+    public void cannot_create_instance_of_object() throws InterruptedException {
         // try to create an instance of object 50
         CreateResponse response = helper.server
                 .send(helper.getClient(), new CreateRequest(50, 0, new LwM2mResource[0]));
@@ -116,7 +116,7 @@ public class CreateTest {
     // but you will not make a create with this two resource.
     @Ignore
     @Test
-    public void cannot_create_instance_without_all_required_resources() {
+    public void cannot_create_instance_without_all_required_resources() throws InterruptedException {
         // create ACL instance
         CreateResponse response = helper.server.send(helper.getClient(), new CreateRequest(2, 0, new LwM2mResource[0]));
 
@@ -132,7 +132,7 @@ public class CreateTest {
     // TODO we must probably implement this.
     @Ignore
     @Test
-    public void cannot_create_instance_with_extraneous_resources() {
+    public void cannot_create_instance_with_extraneous_resources() throws InterruptedException {
         // create ACL instance
         LwM2mResource accessControlOwner = LwM2mSingleResource.newIntegerResource(3, 123);
         LwM2mResource extraneousResource = LwM2mSingleResource.newIntegerResource(50, 123);
@@ -156,7 +156,7 @@ public class CreateTest {
     }
 
     @Test
-    public void cannot_create_mandatory_single_object() {
+    public void cannot_create_mandatory_single_object() throws InterruptedException {
         // try to create another instance of device object
         CreateResponse response = helper.server.send(helper.getClient(), new CreateRequest(3, 0, new LwM2mResource[0]));
 
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java
index 7f5faa47..9112f123 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java
@@ -47,7 +47,7 @@ public class DeleteTest {
     }
 
     @Test
-    public void delete_created_object_instance() {
+    public void delete_created_object_instance() throws InterruptedException {
         // create ACL instance
         helper.server.send(helper.getClient(), new CreateRequest(2, 0, new LwM2mResource[0]));
 
@@ -59,7 +59,7 @@ public class DeleteTest {
     }
 
     @Test
-    public void cannot_delete_unknown_object_instance() {
+    public void cannot_delete_unknown_object_instance() throws InterruptedException {
         // try to create an instance of object 50
         DeleteResponse response = helper.server.send(helper.getClient(), new DeleteRequest(2, 0));
 
@@ -68,7 +68,7 @@ public class DeleteTest {
     }
 
     @Test
-    public void cannot_delete_single_manadatory_object_instance() {
+    public void cannot_delete_single_manadatory_object_instance() throws InterruptedException {
         // try to create an instance of object 50
         DeleteResponse response = helper.server.send(helper.getClient(), new DeleteRequest(3, 0));
 
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java
index e4ab2901..03f3c524 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java
@@ -48,7 +48,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void can_discover_object() {
+    public void can_discover_object() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(2));
 
@@ -60,7 +60,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void cant_discover_non_existent_object() {
+    public void cant_discover_non_existent_object() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(4));
 
@@ -69,7 +69,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void can_discover_object_instance() {
+    public void can_discover_object_instance() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(3, 0));
 
@@ -81,7 +81,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void cant_discover_non_existent_instance() {
+    public void cant_discover_non_existent_instance() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(3, 1));
 
@@ -90,7 +90,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void can_discover_resource() {
+    public void can_discover_resource() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(3, 0, 0));
 
@@ -102,7 +102,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void cant_discover_resource_of_non_existent_object() {
+    public void cant_discover_resource_of_non_existent_object() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(4, 0, 0));
 
@@ -111,7 +111,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void cant_discover_resource_of_non_existent_instance() {
+    public void cant_discover_resource_of_non_existent_instance() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(3, 1, 0));
 
@@ -120,7 +120,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void cant_discover_resource_of_non_existent_instance_and_resource() {
+    public void cant_discover_resource_of_non_existent_instance_and_resource() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(3, 1, 20));
 
@@ -129,7 +129,7 @@ public class DiscoverTest {
     }
 
     @Test
-    public void cant_discover_resource_of_non_existent_resource() {
+    public void cant_discover_resource_of_non_existent_resource() throws InterruptedException {
         // read ACL object
         DiscoverResponse response = helper.server.send(helper.getClient(), new DiscoverRequest(3, 0, 20));
 
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java
index 3b93bc6b..0622c5fe 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java
@@ -46,7 +46,7 @@ public class ExecuteTest {
     }
 
     @Test
-    public void cannot_execute_read_only_resource() {
+    public void cannot_execute_read_only_resource() throws InterruptedException {
         // execute manufacturer resource on device
         ExecuteResponse response = helper.server.send(helper.getClient(), new ExecuteRequest(3, 0, 0));
 
@@ -55,7 +55,7 @@ public class ExecuteTest {
     }
 
     @Test
-    public void cannot_execute_read_write_resource() {
+    public void cannot_execute_read_write_resource() throws InterruptedException {
         // execute current time resource on device
         ExecuteResponse response = helper.server.send(helper.getClient(), new ExecuteRequest(3, 0, 13));
 
@@ -64,28 +64,28 @@ public class ExecuteTest {
     }
 
     @Test
-    public void cannot_execute_nonexisting_resource_on_existing_object() {
+    public void cannot_execute_nonexisting_resource_on_existing_object() throws InterruptedException {
         final int nonExistingResourceId = 9999;
         // execute non existing resource on device
-        ExecuteResponse response = helper.server.send(helper.getClient(),
-                new ExecuteRequest(3, 0, nonExistingResourceId));
+        ExecuteResponse response = helper.server.send(helper.getClient(), new ExecuteRequest(3, 0,
+                nonExistingResourceId));
 
         // verify result
         assertEquals(ResponseCode.NOT_FOUND, response.getCode());
     }
 
     @Test
-    public void cannot_execute_nonexisting_resource_on_non_existing_object() {
+    public void cannot_execute_nonexisting_resource_on_non_existing_object() throws InterruptedException {
         final int nonExistingObjectId = 9999;
-        ExecuteResponse response = helper.server.send(helper.getClient(),
-                new ExecuteRequest(nonExistingObjectId, 0, 0));
+        ExecuteResponse response = helper.server
+                .send(helper.getClient(), new ExecuteRequest(nonExistingObjectId, 0, 0));
 
         // verify result
         assertEquals(ResponseCode.NOT_FOUND, response.getCode());
     }
 
     @Test
-    public void can_execute_resource() {
+    public void can_execute_resource() throws InterruptedException {
         // execute reboot resource on device
         ExecuteResponse response = helper.server.send(helper.getClient(), new ExecuteRequest(3, 0, 4));
 
@@ -94,7 +94,7 @@ public class ExecuteTest {
     }
 
     @Test
-    public void can_execute_resource_with_parameters() {
+    public void can_execute_resource_with_parameters() throws InterruptedException {
         // execute reboot after 60 seconds on device
         ExecuteResponse response = helper.server.send(helper.getClient(), new ExecuteRequest(3, 0, 4, "60"));
 
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/IntegrationTestHelper.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/IntegrationTestHelper.java
index 54536e39..ced62b97 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/IntegrationTestHelper.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/IntegrationTestHelper.java
@@ -86,7 +86,7 @@ public class IntegrationTestHelper {
     public void createServer() {
         LeshanServerBuilder builder = new LeshanServerBuilder();
         builder.setLocalAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
-        builder.setLocalAddressSecure(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+        builder.setLocalSecureAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
         builder.setSecurityRegistry(new SecurityRegistryImpl() {
             // TODO we should separate SecurityRegistryImpl in 2 registries :
             // InMemorySecurityRegistry and PersistentSecurityRegistry
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ReadTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ReadTest.java
index 6728306d..59ea5e2b 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ReadTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ReadTest.java
@@ -54,7 +54,7 @@ public class ReadTest {
     // TODO we must the object TLV encoding
     @Ignore
     @Test
-    public void can_read_empty_object() {
+    public void can_read_empty_object() throws InterruptedException {
         // read ACL object
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(2));
 
@@ -69,7 +69,7 @@ public class ReadTest {
     // TODO we must the object TLV encoding
     @Ignore
     @Test
-    public void can_read_object() {
+    public void can_read_object() throws InterruptedException {
         // read device object
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(3));
 
@@ -84,7 +84,7 @@ public class ReadTest {
     }
 
     @Test
-    public void can_read_object_instance() {
+    public void can_read_object_instance() throws InterruptedException {
         // read device single instance
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(3, 0));
 
@@ -96,7 +96,7 @@ public class ReadTest {
     }
 
     @Test
-    public void can_read_resource() {
+    public void can_read_resource() throws InterruptedException {
         // read device model number
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(3, 0, 1));
 
@@ -109,7 +109,7 @@ public class ReadTest {
     }
 
     @Test
-    public void cannot_read_non_readable_resource() {
+    public void cannot_read_non_readable_resource() throws InterruptedException {
         // read device reboot resource
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(3, 0, 4));
 
@@ -118,7 +118,7 @@ public class ReadTest {
     }
 
     @Test
-    public void cannot_read_non_existent_object() {
+    public void cannot_read_non_existent_object() throws InterruptedException {
         // read object "50"
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(50));
 
@@ -127,7 +127,7 @@ public class ReadTest {
     }
 
     @Test
-    public void cannot_read_non_existent_instance() {
+    public void cannot_read_non_existent_instance() throws InterruptedException {
         // read 2nd Device resource
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(3, 1));
 
@@ -136,7 +136,7 @@ public class ReadTest {
     }
 
     @Test
-    public void cannot_read_non_existent_resource() {
+    public void cannot_read_non_existent_resource() throws InterruptedException {
         // read device 50 resource
         ReadResponse response = helper.server.send(helper.getClient(), new ReadRequest(3, 0, 50));
 
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java
index 533e83a0..f43e4da0 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java
@@ -97,7 +97,7 @@ public class RegistrationTest {
     }
 
     @Test
-    public void register_with_additional_attributes() {
+    public void register_with_additional_attributes() throws InterruptedException {
         // Check registration
         assertTrue(helper.server.getClientRegistry().allClients().isEmpty());
 
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecureIntegrationTestHelper.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecureIntegrationTestHelper.java
index 464d00d4..dff9d8eb 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecureIntegrationTestHelper.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecureIntegrationTestHelper.java
@@ -231,7 +231,7 @@ public class SecureIntegrationTestHelper extends IntegrationTestHelper {
     public void createServerWithRPK() {
         LeshanServerBuilder builder = new LeshanServerBuilder();
         builder.setLocalAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
-        builder.setLocalAddressSecure(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+        builder.setLocalSecureAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
         builder.setSecurityRegistry(new SecurityRegistryImpl(serverPrivateKey, serverPublicKey) {
             // TODO we should separate SecurityRegistryImpl in 2 registries :
             // InMemorySecurityRegistry and PersistentSecurityRegistry
@@ -252,7 +252,7 @@ public class SecureIntegrationTestHelper extends IntegrationTestHelper {
     public void createServerWithX509Cert(Certificate[] trustedCertificates) {
         LeshanServerBuilder builder = new LeshanServerBuilder();
         builder.setLocalAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
-        builder.setLocalAddressSecure(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+        builder.setLocalSecureAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
 
         builder.setSecurityRegistry(new SecurityRegistryImpl(serverPrivateKeyFromCert, serverX509CertChain,
                 trustedCertificates) {
diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/WriteTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/WriteTest.java
index fb5e83d2..ced6977b 100644
--- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/WriteTest.java
+++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/WriteTest.java
@@ -51,7 +51,7 @@ public class WriteTest {
     }
 
     @Test
-    public void can_write_replace_resource() {
+    public void can_write_replace_resource() throws InterruptedException {
         // write device timezone
         final String timeZone = "Europe/Paris";
         WriteResponse response = helper.server.send(helper.getClient(), new WriteRequest(Mode.REPLACE, 3, 0, 15,
@@ -67,7 +67,7 @@ public class WriteTest {
     }
 
     @Test
-    public void can_write_replace_resource_in_json() {
+    public void can_write_replace_resource_in_json() throws InterruptedException {
         // write device timezone
         final String timeZone = "Europe/Paris";
         WriteResponse response = helper.server.send(helper.getClient(), new WriteRequest(Mode.REPLACE, 3, 0, 15,
@@ -83,7 +83,7 @@ public class WriteTest {
     }
 
     @Test
-    public void cannot_write_non_writable_resource() {
+    public void cannot_write_non_writable_resource() throws InterruptedException {
         // try to write unwritable resource like manufacturer on device
         final String manufacturer = "new manufacturer";
         WriteResponse response = helper.server.send(helper.getClient(), new WriteRequest(Mode.REPLACE, 3, 0, 0,
@@ -94,7 +94,7 @@ public class WriteTest {
     }
 
     @Test
-    public void can_write_object_instance() {
+    public void can_write_object_instance() throws InterruptedException {
         // write device timezone and offset
         LwM2mResource utcOffset = LwM2mSingleResource.newStringResource(14, "+02");
         LwM2mResource timeZone = LwM2mSingleResource.newStringResource(15, "Europe/Paris");
@@ -112,7 +112,7 @@ public class WriteTest {
     }
 
     @Test
-    public void can_write_object_instance_in_json() {
+    public void can_write_object_instance_in_json() throws InterruptedException {
         // write device timezone and offset
         LwM2mResource utcOffset = LwM2mSingleResource.newStringResource(14, "+02");
         LwM2mResource timeZone = LwM2mSingleResource.newStringResource(15, "Europe/Paris");