From 2affd9f6c7ebc43779debf7d9fd87c7631ddd239 Mon Sep 17 00:00:00 2001
From: Emmanuel Bruno <emmanuel.bruno@univ-tln.fr>
Date: Fri, 10 Dec 2021 09:32:41 +0100
Subject: [PATCH] fixes certs.

---
 .gitignore                                                     | 2 ++
 README.md                                                      | 3 ++-
 .../java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 861db79..3c98739 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,5 @@ proguard/
 *.ear%
 
 .DS_Store
+/websocketClient/src/main/resources/localhost.der
+/websocketClient/src/main/resources/mycert-pub.jks
diff --git a/README.md b/README.md
index 4935b3e..772f677 100644
--- a/README.md
+++ b/README.md
@@ -14,8 +14,9 @@
       http://localhost:8080/restApp/sample/persons
    6. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403
    7. curl -H "Accept: text/xml" http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons
+
 ## Import "real" certificate
 
-  openssl x509 -outform der -in localhost.pem -out localhost.der
+  openssl s_client -showcerts -servername localhost -connect localhost:8181 </dev/null | openssl x509 -outform DER > localhost.der
   keytool -import -noprompt -trustcacerts -storepass storepass -alias localhost -keystore mycert-pub.jks -file localhost.der
 
diff --git a/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java b/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java
index 3ed8607..30201cc 100644
--- a/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java
+++ b/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java
@@ -41,7 +41,7 @@ public class WsClient {
     public static void main(String[] args) {
         try {
 
-            final WsClient clientEndPoint = new WsClient(new URI("ws://localhost:8686/wsApp/hellows"));
+            final WsClient clientEndPoint = new WsClient(new URI("wss://localhost:8181/wsApp/hellows"));
             clientEndPoint.sendMessage("Hello 1 !");
             Thread.sleep(5000);
             clientEndPoint.sendMessage("Hello 2 !");
-- 
GitLab