Skip to content

Commit

Permalink
Add force fullhandshake/force reconnect on update options to client demo
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Mar 9, 2020
1 parent 31f9cda commit d6199ab
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public static void main(final String[] args) {
"Set the local CoAP port of the Client.\n Default: A valid port value is between 0 and 65535.");
options.addOption("u", true, String.format("Set the LWM2M or Bootstrap server URL.\nDefault: localhost:%d.",
LwM2m.DEFAULT_COAP_PORT));
options.addOption("r", false, "Force reconnect/rehandshake on update.");
options.addOption("f", false, "Do not try to resume session always, do a full handshake.");
options.addOption("ocf",
"activate support of old/unofficial content format .\n See https://github.com/eclipse/leshan/pull/720");
options.addOption("oc", "activate support of old/deprecated cipher suites.");
Expand Down Expand Up @@ -396,7 +398,7 @@ public static void main(final String[] args) {
createAndStartClient(endpoint, localAddress, localPort, cl.hasOption("b"), additionalAttributes, lifetime,
communicationPeriod, serverURI, pskIdentity, pskKey, clientPrivateKey, clientPublicKey,
serverPublicKey, clientCertificate, serverCertificate, latitude, longitude, scaleFactor,
cl.hasOption("ocf"), cl.hasOption("oc"));
cl.hasOption("ocf"), cl.hasOption("oc"), cl.hasOption("r"), cl.hasOption("f"));
} catch (Exception e) {
System.err.println("Unable to create and start client ...");
e.printStackTrace();
Expand All @@ -409,7 +411,8 @@ public static void createAndStartClient(String endpoint, String localAddress, in
byte[] pskIdentity, byte[] pskKey, PrivateKey clientPrivateKey, PublicKey clientPublicKey,
PublicKey serverPublicKey, X509Certificate clientCertificate, X509Certificate serverCertificate,
Float latitude, Float longitude, float scaleFactor, boolean supportOldFormat,
boolean supportDeprecatedCiphers) throws CertificateEncodingException {
boolean supportDeprecatedCiphers, boolean reconnectOnUpdate, boolean forceFullhandshake)
throws CertificateEncodingException {

locationInstance = new MyLocation(latitude, longitude, scaleFactor);

Expand Down Expand Up @@ -476,6 +479,8 @@ public static void createAndStartClient(String endpoint, String localAddress, in
// Configure Registration Engine
DefaultRegistrationEngineFactory engineFactory = new DefaultRegistrationEngineFactory();
engineFactory.setCommunicationPeriod(communicationPeriod);
engineFactory.setReconnectOnUpdate(reconnectOnUpdate);
engineFactory.setResumeOnConnect(!forceFullhandshake);

// Create client
LeshanClientBuilder builder = new LeshanClientBuilder(endpoint);
Expand Down

0 comments on commit d6199ab

Please sign in to comment.