B4J Question How to setup a Secure Web Socket server (WSS)

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!

I need to use WSS to the Custom Websocket Push Framework by Erel, in order to conform to the GDPR about encrypted data.
I’ m a little bit confused on how to setup the server and the Android client sides to use WSS instead of simple WS protocol.
Is there any step by step guide?

Thank you in advance!
 

vfafou

Well-Known Member
Licensed User
Longtime User
Hi Erel!
I have done the process to make a keystore an a certificate and I take the following error:
B4X:
Error occurred on line: 153
java.net.BindException: Address already in use: bind
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:433)
    at java.base/sun.nio.ch.Net.bind(Net.java:425)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:225)
    at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:298)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.server.Server.doStart(Server.java:431)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:211)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:657)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
    at vf.package.main.main(main.java:29)

Any idea?

Thank you in advance!
 
Upvote 0

vfafou

Well-Known Member
Licensed User
Longtime User
Hello Erel!

I've finally done the server start with SSL certificate.
My problem is that when I try to connect from an android client to the wss, the client does not connect and I take the following in B4J app:
B4X:
2018-06-02 00:06:35.580:WARN:oejh.HttpParser:qtp1991313236-22: Illegal character 0x16 in state=START for buffer HeapByteBuffer@3196055b[p=1,l=135,c=8192,r=134]={\x16<<<\x03\x01\x00\x82\x01\x00\x00~\x03\x03\n\xFfP?\x93\x0es...\x03\x00\x0b\x00\x02\x01\x00\x00\n\x00\x04\x00\x02\x00\x17>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}

I'm using B4j 6.30, B4A 8.0 and JDK 10.

Thank you in advance!
 
Upvote 0
Top