@Override
    public Connection createConnection(Url url) throws Exception {
        Channel channel = doCreateConnection(url.getIp(), url.getPort(), url.getConnectTimeout());
        Connection conn = new Connection(channel, ProtocolCode.fromBytes(url.getProtocol()),
            url.getVersion(), url);
        if (channel.isActive()) {
            channel.pipeline().fireUserEventTriggered(ConnectionEventType.CONNECT);
        } else {
            channel.pipeline().fireUserEventTriggered(ConnectionEventType.CONNECT_FAILED);
            throw new RemotingException("create connection, but channel is inactive, url is "
                                        + url.getOriginUrl());
        }
        return conn;
    }
ConnectionFactory to create connection.

@author chengyi (mark.lx@antfin.com) 2018-06-20 14:29
src/main/java/com/alipay/remoting/connection/AbstractConnectionFactory.java