void startTLSReceived ( boolean required ) { if ( required && config . getSecurityMode ( ) == ConnectionConfiguration . SecurityMode . disabled ) { notifyConnectionError ( new IllegalStateException ( "TLS required by server but not allowed by connection configuration" ) ) ; return ; } if ( config . getSecurityMode ( ) == ConnectionConfiguration . SecurityMode . disabled ) { // Do not secure the connection using TLS since TLS was disabled return ; } try { writer . write ( "<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>" ) ; writer . flush ( ) ; } catch ( IOException e ) { notifyConnectionError ( e ) ; } }
Notification message saying that the server supports TLS so confirm the server that we want to secure the connection .