当前位置: 首页>>代码示例>>Java>>正文


Java Type.DIRECT属性代码示例

本文整理汇总了Java中java.net.Proxy.Type.DIRECT属性的典型用法代码示例。如果您正苦于以下问题:Java Type.DIRECT属性的具体用法?Java Type.DIRECT怎么用?Java Type.DIRECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.net.Proxy.Type的用法示例。


在下文中一共展示了Type.DIRECT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldPipeline

private boolean shouldPipeline()
{
    if (!this.pipeline)
    {
        return false;
    }
    else
    {
        Proxy proxy = Minecraft.getMinecraft().getProxy();
        return proxy.type() != Type.DIRECT && proxy.type() != Type.SOCKS ? false : this.imageUrl.startsWith("http://");
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:ThreadDownloadImageData.java

示例2: connectFailed

public void connectFailed(Route failedRoute, IOException failure) {
    if (!(failedRoute.getProxy().type() == Type.DIRECT || this.address.getProxySelector() ==
            null)) {
        this.address.getProxySelector().connectFailed(this.address.url().uri(), failedRoute
                .getProxy().address(), failure);
    }
    this.routeDatabase.failed(failedRoute);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:RouteSelector.java

示例3: resetNextInetSocketAddress

private void resetNextInetSocketAddress(Proxy proxy) throws IOException {
    String socketHost;
    int socketPort;
    this.inetSocketAddresses = new ArrayList();
    if (proxy.type() == Type.DIRECT || proxy.type() == Type.SOCKS) {
        socketHost = this.address.getUriHost();
        socketPort = this.address.getUriPort();
    } else {
        SocketAddress proxyAddress = proxy.address();
        if (proxyAddress instanceof InetSocketAddress) {
            InetSocketAddress proxySocketAddress = (InetSocketAddress) proxyAddress;
            socketHost = getHostString(proxySocketAddress);
            socketPort = proxySocketAddress.getPort();
        } else {
            throw new IllegalArgumentException("Proxy.address() is not an InetSocketAddress: " +
                    "" + proxyAddress.getClass());
        }
    }
    if (socketPort < 1 || socketPort > 65535) {
        throw new SocketException("No route to " + socketHost + ":" + socketPort + "; port is" +
                " out of range");
    }
    if (proxy.type() == Type.SOCKS) {
        this.inetSocketAddresses.add(InetSocketAddress.createUnresolved(socketHost,
                socketPort));
    } else {
        List<InetAddress> addresses = this.address.getDns().lookup(socketHost);
        int size = addresses.size();
        for (int i = 0; i < size; i++) {
            this.inetSocketAddresses.add(new InetSocketAddress((InetAddress) addresses.get(i)
                    , socketPort));
        }
    }
    this.nextInetSocketAddressIndex = 0;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:35,代码来源:RouteSelector.java

示例4: usingProxy

public final boolean usingProxy() {
    Proxy proxy;
    if (this.route != null) {
        proxy = this.route.getProxy();
    } else {
        proxy = this.client.getProxy();
    }
    return (proxy == null || proxy.type() == Type.DIRECT) ? false : true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:HttpURLConnectionImpl.java

示例5: toType

Type toType(){
    switch (this){
        case SOCKS: return Type.SOCKS;
        case HTTP: return Type.HTTP;
    }
    return  Type.DIRECT;
}
 
开发者ID:PacktPublishing,项目名称:Asynchronous-Android-Programming,代码行数:7,代码来源:HTTPProxy.java

示例6: getConnectToInetAddress

private InetAddress getConnectToInetAddress(Proxy proxy, HttpUrl url) throws IOException {
    if (proxy == null || proxy.type() == Type.DIRECT) {
        return InetAddress.getByName(url.host());
    }
    return ((InetSocketAddress) proxy.address()).getAddress();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:AuthenticatorAdapter.java

示例7: connect

public void connect(int connectTimeout, int readTimeout, int writeTimeout,
                    List<ConnectionSpec> connectionSpecs, boolean connectionRetryEnabled)
        throws RouteException {
    if (this.protocol != null) {
        throw new IllegalStateException("already connected");
    }
    RouteException routeException = null;
    ConnectionSpecSelector connectionSpecSelector = new ConnectionSpecSelector(connectionSpecs);
    Proxy proxy = this.route.getProxy();
    Address address = this.route.getAddress();
    if (this.route.getAddress().getSslSocketFactory() != null || connectionSpecs.contains
            (ConnectionSpec.CLEARTEXT)) {
        while (this.protocol == null) {
            try {
                Socket createSocket = (proxy.type() == Type.DIRECT || proxy.type() == Type
                        .HTTP) ? address.getSocketFactory().createSocket() : new Socket(proxy);
                this.rawSocket = createSocket;
                connectSocket(connectTimeout, readTimeout, writeTimeout,
                        connectionSpecSelector);
            } catch (IOException e) {
                Util.closeQuietly(this.socket);
                Util.closeQuietly(this.rawSocket);
                this.socket = null;
                this.rawSocket = null;
                this.source = null;
                this.sink = null;
                this.handshake = null;
                this.protocol = null;
                if (routeException == null) {
                    routeException = new RouteException(e);
                } else {
                    routeException.addConnectException(e);
                }
                if (!connectionRetryEnabled || !connectionSpecSelector.connectionFailed(e)) {
                    throw routeException;
                }
            }
        }
        return;
    }
    throw new RouteException(new UnknownServiceException("CLEARTEXT communication not " +
            "supported: " + connectionSpecs));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:RealConnection.java


注:本文中的java.net.Proxy.Type.DIRECT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。