So Server and Client are both different from each other (though may share some stuff), and SSH and Socket are also different from each other but share a common interface.
So, Server and Client (or their base class) "has" (not "is"!) a Connection. A Connection may be different concrete classes, or may be a single class that "has" a BackEnd. Note that in Perl you are more flexible in not having to define an "Interface" or have explicit base/derived relationships. Each concrete class can be implemented in any way it likes.