java - WSS Handshake instantly canceled after HandshakeCompletedEvent -


I am trying to code a WSS server in Java:

  string stringname = "Keystore"; String path = "c: \\ user \\ black \\ desktop \\" + certificate name + ".jks"; Four [] passphrase = "123456". Kocharaire (); Mainstream Keystore = Keystore.Testinstance (Keystore.GetFileType ()); KeyStore.load (new FileInputStream (path), passphrase); KeyManagerFactory kmf = KeyManagerFactory.getInstance ("SunX509"); Kmf.init (keystore, passphrase); SSLContext ctx = SSLContext.getInstance ("TLS"); Ctx.init (km f.jetkey manager (), faucet, faucet); SSLServerSocketFactory sslserversocketfactory = ctx.getServerSocketFactory (); ServerSocket = (SSLServerSocket) sslserversocketfactory.createServerSocket (Port); ServerSocket.setEnabledProtocols (new string [] {"TLSv1", "TLSv1.1", "TLSv1.2", "SSLv3"}); ClientSocket = (SSLSocket) serverSocket.accept (); ClientSocket.addHandshakeCompletedListener (New Handshake Compiled Listener) {@ Override Public Wide Handshake Full (Handshake Compatible Event RGET) {System.out.println (arg0.toString ());}}); Out = clientSocket.getOutputStream (); Outprint = new printwire (out, true); Reader = New Reader (this, clientSocket.getInputStream ()); Reader.start ();  

In the console it is printing me hand section completely and immediately after this, the connection is lost ( bufferedinputreader.read () Return -1)

My customer in JS

  var serviceUrl = 'wss: // localhost: 9898 /'; Var Protocol = 'Ax 1'; Var Socket = New WebSocket (Service URL, Protocol); Socket.onopen = function () {console.log ('Setting Up Connection!'); SetInterval (test (socket), 1000); }; Socket.onclose = function () {console.log ('Closed connection!'); }; Socket.onerror = function (error) {console.log ('error occurred:' + error); }; Socket.onmessage = function (e) {var obj = JSON.parse (e.data); Console.log ("Type:" + obj.type + "| Specific:" + obj.specific); };  

Returns: WebSocket Connection to Failed 'wss: // localhost: 9898 /': WebSocket Opening Handshake canceled error occurred: [Object Event]

Keystore self is signed and Java Key is generated with toll. I can not understand the error, because I do not get any exception.

Customer uses the correct protocol / cipher suite because I have printed them after socket.accept ()) .


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -