[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [paho-dev] Looking for Java Client sample code for secure WebSocket connection
|
Hi Mike,
Which broker are you using for this? The HTTP_HEADER_UPGRADE header is required to change the initial http connection into a web socket and so the null pointer is correct (though a better error might be a good improvement for 1.3.0). I've tested this with the iot.eclipse.leg Mosquitto, but not with other brokers so can't guarantee the results on them...
Hi James,
Thanks for the reply.. I found this
sample in your git account: https://github.com/jpwsutton/EclipsePahoMavenExample/blob/master/src/main/java/org/eclipse/paho/App.java
My code is not much different from yours,
but keep hitting NullPointerException exception in receiveHandshakeResponse()
because HTTP_HEADER_UPGRADEwas
not in the response. Note that _javascript_ client works fine on both
1883 and 443 ports.
NullPointerException on a WebSocket
connection:
INFO: main: Connecting client d:xxxxxx:xxxxxx:xxxxxx
to ws://xxxxxx.messaging.internetofthings.ibmcloud.com:1883
MqttException (0) - java.lang.NullPointerException
at
org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
at
org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:664)
at
java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at
org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketHandshake.receiveHandshakeResponse(WebSocketHandshake.java:133)
at
org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketHandshake.execute(WebSocketHandshake.java:74)
at
org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketNetworkModule.start(WebSocketNetworkModule.java:78)
at
org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650)
NullPointerException on a secure WebSocket
connection:
INFO: main: Connecting client d:d:xxxxxx:xxxxxx:xxxxxx to wss://xxxxxx.messaging.internetofthings.ibmcloud.com:443
MqttException (0) - java.lang.NullPointerException
at
org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
at
org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:664)
at
java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at
org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketHandshake.receiveHandshakeResponse(WebSocketHandshake.java:133)
at
org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketHandshake.execute(WebSocketHandshake.java:74)
at
org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketSecureNetworkModule.start(WebSocketSecureNetworkModule.java:77)
at
org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650)
From:
James Sutton <jpwsutton+eclipse@xxxxxxxxx>
To:
General development
discussions for paho project <paho-dev@xxxxxxxxxxx>
Date:
08/10/2016 04:49 AM
Subject:
Re: [paho-dev]
Looking for Java Client sample code for secure WebSocket connection
Sent by:
paho-dev-bounces@xxxxxxxxxxx
Hi Mike, if you have a look at my github account, I have
a Java SSL example project. Simply take that and change the server Uri
to wss: and it should work.
Sorry for no link, I'm currently on holiday without my
laptop!
James
On Tue, 9 Aug 2016, 20:02 Mike Tran, <miketran@xxxxxxxxxx>
wrote:
Hi all,
I have been searching for a sample code for wss:// connection. Please
let me know if we already have one somewhere in the archive... Thanks.
--
Regards,
Mike Tran
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev