agave-systems/systems-core/src/main/java/org/iplantc/service/transfer/sftp/SftpRelay.java
/**
     * Create a socket, initialize it and connect.
     * If connect fails then throw RemoteConnectionException
     *
     * @param connectTimeout
     * @param socketTimeout
     * @param username
     * @param host
     * @param port
     * @param proxyHost
     * @param proxyPort
     * @param msgPrefix
     * @return
     * @throws RemoteConnectionException
     */
Create a socket, initialize it and connect.
If connect fails then throw RemoteConnectionException


Create a socket initialize it and connect . If connect fails then throw RemoteConnectionException
public Socket connect(int connectTimeout, int socketTimeout, String username, String host,
                          int port, String proxyHost, int proxyPort, String msgPrefix)
            throws RemoteConnectionException {
        SocketAddress sockaddr;
        Socket retSock = new Socket();
        if (useTunnel()) {
            sockaddr = new InetSocketAddress(proxyHost, proxyPort);
        } else {
            sockaddr = new InetSocketAddress(host, port);
        }
         Note the original Agave code connected before setting these options,
         which at least in the case of the performance preferences caused them
         to be ignored.
         Timeouts may get adjusted on retries.
        if (log.isDebugEnabled()) {
            log.debug("Setting connect timeout to " + connectTimeout + "ms.");
            log.debug("Setting socket timeout to " + socketTimeout + "ms.");
        }
        try {
            retSock.setTcpNoDelay(true);
            retSock.setPerformancePreferences(0, 1, 2);
            retSock.setSoTimeout(socketTimeout);
            retSock.connect(sockaddr, connectTimeout);
        } catch (Exception e) {
            String msg = String.format("Socket connection failure for %s : %s", msgPrefix, e.getMessage());
            log.error(msg);
             We can retry connection failures.
            throw new RemoteConnectionException(e.getMessage(), e);  socket should be closed in a final catch clause.
        }
        return retSock;
    }
public Socket connect ( int connectTimeout , int socketTimeout , String username , String host , int port , String proxyHost , int proxyPort , String msgPrefix ) throws RemoteConnectionException { SocketAddress sockaddr ; Socket retSock = new Socket ( ) ; if ( useTunnel ( ) ) { sockaddr = new InetSocketAddress ( proxyHost , proxyPort ) ; } else { sockaddr = new InetSocketAddress ( host , port ) ; } try { retSock . setTcpNoDelay ( true ) ; retSock . setPerformancePreferences ( 0 , 1 , 2 ) ; retSock . setSoTimeout ( socketTimeout ) ; retSock . connect ( sockaddr , connectTimeout ) ; } catch ( Exception e ) { String msg = String . format ( "Socket connection failure for %s : %s" , msgPrefix , e . getMessage ( ) ) ; log . error ( msg ) ; throw new RemoteConnectionException ( e . getMessage ( ) , e ) ; } return retSock ; }
Create a socket, initialize it and connect.
Create a socket initialize it and connect .
//Initialize socket. // Configure the socket and make the connection. //  - No delay means send each buffer without waiting to fill a packet. //  - The performance preferences mean bandwidth, latency, connection time //    are given that priority. //  - The connect timeout only applies to socket connection. //  - The SO timeout applies to any blocking call on the socket. // // Note the original Agave code connected before setting these options, // which at least in the case of the performance preferences caused them // to be ignored. // Timeouts may get adjusted on retries. //        if (log.isDebugEnabled()) { //            log.debug("Setting connect timeout to " + connectTimeout + "ms."); //            log.debug("Setting socket timeout to " + socketTimeout + "ms."); //        } // We can retry connection failures. // socket should be closed in a final catch clause.