diff --git a/session.go b/session.go index 04678b7..22d76b2 100644 --- a/session.go +++ b/session.go @@ -29,12 +29,14 @@ func NewSession(transport Transport, o Config, state SMState) (*Session, error) s.SMState = state s.init(o) - s.startTlsIfSupported(o) - if s.err != nil { return nil, NewConnError(s.err, true) } + if !transport.IsSecure() { + s.startTlsIfSupported(o) + } + if !transport.IsSecure() && !o.Insecure { err := fmt.Errorf("failed to negotiate TLS session : %s", s.err) return nil, NewConnError(err, true)