public static Transport getTransport(SocketAddress addr) throws IOException {
        Transport trans;
        try {
            log.debug("Connecting TCP");
            trans = TCPInstance(addr);
            if (!trans.test()) {
                throw new IOException("Agent is unreachable via TCP");
            }
            return trans;
        } catch (IOException e) {
            log.info("Can't connect TCP transport for host: " + addr.toString(), e);
            try {
                log.debug("Connecting UDP");
                trans = UDPInstance(addr);
                if (!trans.test()) {
                    throw new IOException("Agent is unreachable via UDP");
                }
                return trans;
            } catch (IOException ex) {
                log.info("Can't connect UDP transport for host: " + addr.toString(), ex);
                throw ex;
            }
        }
    }
public static Transport getTransport ( SocketAddress addr ) throws IOException { Transport trans ; try { log . debug ( "Connecting TCP" ) ; trans = TCPInstance ( addr ) ; if ( ! trans . test ( ) ) { throw new IOException ( "Agent is unreachable via TCP" ) ; } return trans ; } catch ( IOException e ) { log . info ( "Can't connect TCP transport for host: " + addr . toString ( ) , e ) ; try { log . debug ( "Connecting UDP" ) ; trans = UDPInstance ( addr ) ; if ( ! trans . test ( ) ) { throw new IOException ( "Agent is unreachable via UDP" ) ; } return trans ; } catch ( IOException ex ) { log . info ( "Can't connect UDP transport for host: " + addr . toString ( ) , ex ) ; throw ex ; } } }
Primary transport getting method. Tries to connect and test UDP Transport.
If UDP failed, tries TCP transport. If it fails, too, throws IOException

@param addr
@return Transport instance
@throws IOException