code: protected Transport createTransport(Session session)
      {
          Transport transport=null;
          try
          {
              //get the transport
              transport=session.getTransport(this.transportProtocol);
  
              //connect
              if(this.transportPort>0)
              {
                  transport.connect(this.transportHost,this.transportPort,this.userName,this.password);
              }
              else
              {
                  transport.connect(this.transportHost,this.userName,this.password);
              }
          }
          catch(Exception exception)
          {
              throw new FaxException("Error while connecting to mail host: "+this.transportHost,exception);
          }
          
          return transport;
      }
docs: This function returns a transport for the provided session.
  
  @param   session
  The mail session
  @return  The mail transport