Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRONG_VERSION_NUMBER(tls_record.cc:231)) #53

Open
mehmetgencdal opened this issue Jan 11, 2025 · 11 comments
Open

WRONG_VERSION_NUMBER(tls_record.cc:231)) #53

mehmetgencdal opened this issue Jan 11, 2025 · 11 comments
Assignees

Comments

@mehmetgencdal
Copy link

When I try to connect I get this error.

I/flutter (15419): [Whixp] 16:48:41.144 Resetting reconnection policy
I/flutter (15419): [Whixp] 16:48:41.151 Trying to connect to heartsapiens.art on port 5222
I/flutter (15419): State changed to: TransportState.connecting
W/WindowOnBackDispatcher(15419): OnBackInvokedCallback is not enabled for the application.
W/WindowOnBackDispatcher(15419): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/EGL_emulation(15419): app_time_stats: avg=5165.71ms min=5165.71ms max=5165.71ms count=1
I/flutter (15419): [Whixp] 16:48:42.081 Error occured while trying to connect to heartsapiens.art
I/flutter (15419): Failed to connect: Connecta exception is thrown while establishing a TLS connection: HandshakeException: Handshake error in client (OS Error: 
I/flutter (15419): 	WRONG_VERSION_NUMBER(tls_record.cc:231))
@mehmetgencdal
Copy link
Author

image

@mehmetgencdal
Copy link
Author

When i set useTLS: false:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
√ Built build\app\outputs\flutter-apk\app-debug.apk
Connecting to VM Service at ws://127.0.0.1:51275/Egn5t62ru7I=/ws
Connected to the VM Service.
I/flutter (18811): State changed to: TransportState.pickingAddress
I/flutter (18811): [Whixp] Trying to connect to heartsapiens.art on port 5222
I/flutter (18811): State changed to: TransportState.connecting
W/WindowOnBackDispatcher(18811): OnBackInvokedCallback is not enabled for the application.
W/WindowOnBackDispatcher(18811): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
I/flutter (18811): State changed to: TransportState.connected
I/flutter (18811): Failed to connect: PathNotFoundException: Creation failed, path = '' (OS Error: No such file or directory, errno = 2)
I/flutter (18811): Session ended
I/flutter (18811): [Whixp] Session ended
I/flutter (18811): State changed to: TransportState.disconnected
I/flutter (18811): State changed to: TransportState.pickingAddress
I/flutter (18811): State changed to: TransportState.connectionFailure
E/flutter (18811): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PathNotFoundException: Creation failed, path = '' (OS Error: No such file or directory, errno = 2)
E/flutter (18811): #0      _checkForErrorResponse (dart:io/common.dart:55:9)
E/flutter (18811): #1      _Directory.create.<anonymous closure> (dart:io/directory_impl.dart:109:9)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #2      BackendManager.open (package:hive/src/backend/vm/backend_manager.dart:34:7)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #3      HiveImpl._openBox (package:hive/src/hive_impl.dart:101:21)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #4      HiveImpl.openBox (package:hive/src/hive_impl.dart:142:12)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #5      HiveController.initialize (package:whixp/src/database/controller.dart:29:14)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #6      new Transport._internal.<anonymous closure> (package:whixp/src/transport.dart:177:9)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #7      Connection._onStart (package:whixp/src/connection.dart:132:5)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811): #8      Connection.start (package:whixp/src/connection.dart:112:7)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811):
E/flutter (18811): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field '_waitingQueueController@561438461' has not been initialized.
E/flutter (18811): #0      Transport._waitingQueueController (package:whixp/src/transport.dart)
E/flutter (18811): #1      Transport._closeStreams (package:whixp/src/transport.dart:667:5)
E/flutter (18811): #2      Transport._setup.<anonymous closure> (package:whixp/src/transport.dart:281:9)
E/flutter (18811): #3      Eventius.emit (package:whixp/src/handler/eventius.dart:135:17)
E/flutter (18811): #4      Transport.emit (package:whixp/src/transport.dart:462:17)
E/flutter (18811): #5      new Transport._internal.<anonymous closure> (package:whixp/src/transport.dart:174:18)
E/flutter (18811): #6      Connection.hangup.consumeSend (package:whixp/src/connection.dart:159:29)
E/flutter (18811): #7      Connection.hangup (package:whixp/src/connection.dart:164:14)
E/flutter (18811): #8      Transport._connectionLost (package:whixp/src/transport.dart:396:22)
E/flutter (18811): #9      _TCPConnecta._handleSocket.<anonymous closure> (package:connecta/src/_tcp.dart:116:19)
E/flutter (18811): #10     _RootZone.runGuarded (dart:async/zone.dart:1582:10)
E/flutter (18811): #11     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:418:13)
E/flutter (18811): #12     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:428:7)
E/flutter (18811): #13     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:317:7)
E/flutter (18811): #14     _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:792:19)
E/flutter (18811): #15     _StreamController._closeUnchecked (dart:async/stream_controller.dart:647:7)
E/flutter (18811): #16     _StreamController.close (dart:async/stream_controller.dart:640:5)
E/flutter (18811): #17     _Socket.destroy (dart:io-patch/socket_patch.dart:2355:17)
E/flutter (18811): #18     ConnectaSocket._destroy (package:connecta/src/socket.dart:68:18)
E/flutter (18811): #19     Connecta.destroy (package:connecta/src/connecta.dart:171:29)
E/flutter (18811): #20     Connection.abort (package:whixp/src/connection.dart:371:20)
E/flutter (18811): #21     Connection.start (package:whixp/src/connection.dart:118:7)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811):
E/flutter (18811): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field '_waitingQueueController@561438461' has not been initialized.
E/flutter (18811): #0      Transport._waitingQueueController (package:whixp/src/transport.dart)
E/flutter (18811): #1      Transport._closeStreams (package:whixp/src/transport.dart:667:5)
E/flutter (18811): #2      Transport._connectionLost (package:whixp/src/transport.dart:399:5)
E/flutter (18811): <asynchronous suspension>
E/flutter (18811):
I/flutter (18811): [Whixp] Trying to connect to heartsapiens.art on port 5222

Screenshot_1

@mhdshah
Copy link

mhdshah commented Jan 11, 2025

I'm also facing the same issue.

Screenshot 2025-01-12 at 2 27 21 AM

@mehmetgencdal
Copy link
Author

@vsevex any solutions?

@mehmetgencdal
Copy link
Author

@mhdshah Which server is your XMPP based on? Metronome, openfire etc?

@mhdshah
Copy link

mhdshah commented Jan 12, 2025

It's Ejabberd

@mhdshah
Copy link

mhdshah commented Jan 12, 2025

I tried with SecurityContext as well.

Screenshot 2025-01-12 at 7 32 23 PM

@mehmetgencdal
Copy link
Author

I didn't try it. It seems I'll use matrix instead of mqtt. Unfortunately

@vsevex
Copy link
Owner

vsevex commented Jan 13, 2025

Hi @mehmetgencdal, @mhdshah,

Thank you for opening an issue. Handshake exceptions are common during connection establishment in Whixp, as the Flutter framework does not provide an easy way to configure StartTLS. To resolve this, you must use DirectTLS in release mode; otherwise, the connection cannot be established. For testing purposes, you must connect to the server without establishing a TLS connection.

Additionally, there is a path exception when trying to initialize Whixp in Flutter. You can fix this issue by referring to the solution mentioned in the documentation.

@vsevex vsevex self-assigned this Jan 13, 2025
@mhdshah
Copy link

mhdshah commented Jan 13, 2025

@vsevex Thanks.

Screenshot 2025-01-13 at 12 55 53 PM

As you suggested, I built the app in release mode, but I still couldn't connect. Am I missing something?

@vsevex
Copy link
Owner

vsevex commented Jan 13, 2025

@mhdshah, this has nothing to do with the release version of the current application. By release, I meant the deployed version of your XMPP server with SSL certificates. The preferred port for this is typically 5223, which is referred to as the TLS-configured port. You need to activate useTLS: true when attempting to connect to this port, as it uses DirectTLS.

In your case, it is preferable to connect to the server without any SSL configuration. Therefore, try connecting to port 5222 after properly configuring your server. Ensure that the SSL configuration for port 5222 is set to false. For example, in this configuration file for the ejabberd server, you can see that the starttls_required property under the 5222 listener is set to true. In your case, you need to set this property to false to avoid a handshake exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants