Clean up and fix StartTLS feature discovery

Required field was never set to true
This commit is contained in:
Mickael Remond
2019-06-10 16:27:52 +02:00
parent 44568fcf2b
commit 709a95129e
7 changed files with 149 additions and 27 deletions

View File

@@ -60,6 +60,30 @@ func TestClient_NoInsecure(t *testing.T) {
mock.Stop()
}
// Check that the client is properly tracking features, as session negotiation progresses.
func TestClient_FeaturesTracking(t *testing.T) {
// Setup Mock server
mock := ServerMock{}
mock.Start(t, testXMPPAddress, handlerAbortTLS)
// Test / Check result
config := Config{Address: testXMPPAddress, Jid: "test@localhost", Password: "test"}
var client *Client
var err error
if client, err = NewClient(config); err != nil {
t.Errorf("cannot create XMPP client: %s", err)
}
if err = client.Connect(); err == nil {
// When insecure is not allowed:
t.Errorf("should fail as insecure connection is not allowed and server does not support TLS")
}
mock.Stop()
}
//=============================================================================
// Basic XMPP Server Mock Handlers.