Como abrir conexão TCP com TLS no scala usando akka

Quero escrever um cliente Scala que fale de um protocolo proprietário por uma conexão TCP com TLS.

Basicamente, quero reescrever o seguinte código do Node.js no Scala:

var conn_options = {
        host: endpoint,
        port: port
};
tlsSocket = tls.connect(conn_options, function() {
      if (tlsSocket.authorized) {
        logger.info('Successfully established a connection');

        // Now that the connection has been established, let's perform the handshake
        // Identification frame:
        // 1 | I | id_size | id
        var idFrameTypeAndVersion = "1I";
        var clientIdString = "foorbar";
        var idDataBuffer = new Buffer(idFrameTypeAndVersion.length + 1 + clientIdString.length);

        idDataBuffer.write(idFrameTypeAndVersion, 0 , 
        idFrameTypeAndVersion.length);

        idDataBuffer.writeUIntBE(clientIdString.length, 
        idFrameTypeAndVersion.length, 1);
        idDataBuffer.write(clientIdString, idFrameTypeAndVersion.length + 1, clientIdString.length);

        // Send the identification frame to Logmet
        tlsSocket.write(idDataBuffer);

      }
      ...
}

Dedocumentação akka Encontrei um bom exemplo com o Akka sobre TCP simples, mas não tenho idéia de como aprimorar o exemplo usando uma conexão de soquete TLS. Existem algumas versões mais antigas da documentação que mostram um exemplocom ssl / tls mas isso está faltando na versão mais recente.

Encontrei documentação sobre umTLS objeto em Akka, mas não encontrei nenhum bom exemplo.

Muito obrigado antecipadamente!

questionAnswers(2)

yourAnswerToTheQuestion