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


Java Proxy.NO_PROXY属性代码示例

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


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

示例1: loginPassword

public static Session loginPassword(String username, String password)
{
    if(username == null || username.length() <= 0 || password == null || password.length() <= 0)
        return null;

    YggdrasilAuthenticationService a = new YggdrasilAuthenticationService(Proxy.NO_PROXY, "");
    YggdrasilUserAuthentication b = (YggdrasilUserAuthentication)a.createUserAuthentication(Agent.MINECRAFT);
    b.setUsername(username);
    b.setPassword(password);
    try
    {
        b.logIn();
        return new Session(b.getSelectedProfile().getName(), b.getSelectedProfile().getId().toString(), b.getAuthenticatedToken(), "LEGACY");
    } catch (AuthenticationException e)
    {
    	altScreen.dispErrorString = "".concat("\247cBad Login \2477(").concat(username).concat(")");
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:Manager.java

示例2: HttpPipelineConnection

public HttpPipelineConnection(String p_i53_1_, int p_i53_2_, Proxy p_i53_3_)
{
    this.host = null;
    this.port = 0;
    this.proxy = Proxy.NO_PROXY;
    this.listRequests = new LinkedList();
    this.listRequestsSend = new LinkedList();
    this.socket = null;
    this.inputStream = null;
    this.outputStream = null;
    this.httpPipelineSender = null;
    this.httpPipelineReceiver = null;
    this.countRequests = 0;
    this.responseReceived = false;
    this.keepaliveTimeoutMs = 5000L;
    this.keepaliveMaxCount = 1000;
    this.timeLastActivityMs = System.currentTimeMillis();
    this.terminated = false;
    this.host = p_i53_1_;
    this.port = p_i53_2_;
    this.proxy = p_i53_3_;
    this.httpPipelineSender = new HttpPipelineSender(this);
    this.httpPipelineSender.start();
    this.httpPipelineReceiver = new HttpPipelineReceiver(this);
    this.httpPipelineReceiver.start();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:HttpPipelineConnection.java

示例3: select

public List<Proxy> select(URI uri) {
    if (uri == null) {
        throw new IllegalArgumentException(ResourceUtils.getString(
                MyProxySelector.class, 
                ERROR_URI_CANNOT_BE_NULL_KEY));
    }
    Proxy proxy = Proxy.NO_PROXY;
    if (byPassSet.contains(uri.getHost())) {
        return Collections.singletonList(proxy);
    }
    if (HTTP_SCHEME.equalsIgnoreCase(uri.getScheme()) || 
            HTTPS_SCHEME.equalsIgnoreCase(uri.getScheme())) {
        if (proxies.containsKey(MyProxyType.HTTP)) {
            proxy = proxies.get(MyProxyType.HTTP).getProxy();
        }
    } else if (FTP_SCHEME.equalsIgnoreCase(uri.getScheme())) {
        if (proxies.containsKey(MyProxyType.FTP)) {
            proxy = proxies.get(MyProxyType.FTP).getProxy();
        }
    } else {
        if (proxies.containsKey(MyProxyType.SOCKS)) {
            proxy = proxies.get(MyProxyType.SOCKS).getProxy();
        }
    }
    return Collections.singletonList(proxy);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:MyProxySelector.java

示例4: testRemoveReplace

public void testRemoveReplace() {
  MyProxySelector selector = new MyProxySelector();
  final MyProxy http = new MyProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 8080)));
  final MyProxy ftp = new MyProxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("hehe.kill.yourself", 8080)), MyProxyType.FTP);
  final MyProxy socks = new MyProxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("localhost", 8080)));
  final MyProxy socks2 = new MyProxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("localhost", 8081)));
  final MyProxy noProxy = new MyProxy(Proxy.NO_PROXY);
  selector.add(http);
  selector.add(socks);
  selector.add(noProxy);
  assertEquals(socks.getProxy(), selector.select(svnURI).get(0));
  selector.add(socks2);
  assertEquals(socks2.getProxy(), selector.select(svnURI).get(0));
  selector.remove(MyProxyType.FTP);
  assertNotNull(selector.getForType(MyProxyType.HTTP));
  assertNotNull(selector.getForType(MyProxyType.SOCKS));
  assertNotNull(selector.getForType(MyProxyType.DIRECT));
  assertNull(selector.getForType(MyProxyType.FTP));
  selector.remove(MyProxyType.HTTP);
  selector.remove(MyProxyType.SOCKS);
  assertNull(selector.getForType(MyProxyType.HTTP));
  assertNull(selector.getForType(MyProxyType.SOCKS));
  assertNotNull(selector.getForType(MyProxyType.DIRECT));
  assertNull(selector.getForType(MyProxyType.FTP));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ProxySelectorTest.java

示例5: toString

static String toString(Proxy proxy) {
    if (proxy == Proxy.NO_PROXY)
        return "DIRECT";
    // java.net.Proxy only knows about http and socks proxies.
    Proxy.Type type = proxy.type();
    switch (type) {
        case HTTP:
            return "PROXY " + proxy.address().toString();
        case SOCKS:
            return "SOCKS5 " + proxy.address().toString();
        case DIRECT:
            return "DIRECT";
        default:
            // If a new proxy type is supported in future, add a case to match it.
            fail("Unknown proxy type" + type);
            return "unknown://";
    }
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:18,代码来源:AndroidProxySelectorTest.java

示例6: DedicatedServer

public DedicatedServer(File anvilFileIn, DataFixer dataFixerIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
    super(anvilFileIn, Proxy.NO_PROXY, dataFixerIn, authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
    Thread thread = new Thread("Server Infinisleeper")
    {
        {
            this.setDaemon(true);
            this.start();
        }
        public void run()
        {
            while (true)
            {
                try
                {
                    Thread.sleep(2147483647L);
                }
                catch (InterruptedException var2)
                {
                    ;
                }
            }
        }
    };
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:DedicatedServer.java

示例7: DedicatedServer

public DedicatedServer(File workDir)
{
    super(workDir, Proxy.NO_PROXY, USER_CACHE_FILE);
    Thread thread = new Thread("Server Infinisleeper")
    {
        {
            this.setDaemon(true);
            this.start();
        }
        public void run()
        {
            while (true)
            {
                try
                {
                    Thread.sleep(2147483647L);
                }
                catch (InterruptedException var2)
                {
                    ;
                }
            }
        }
    };
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:DedicatedServer.java

示例8: main

public static void main(String[] args) throws Exception {
    System.setProperty("http.proxyHost", "myproxy");
    System.setProperty("http.proxyPort", "8080");
    System.setProperty("http.nonProxyHosts", "host1.*");
    ProxySelector sel = ProxySelector.getDefault();
    java.util.List<Proxy> l = sel.select(new URI("http://HOST1.sun.com/"));
    if (l.get(0) != Proxy.NO_PROXY) {
        throw new RuntimeException("ProxySelector returned the wrong proxy");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:B6563259.java

示例9: Minecraft

public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.versionType = gameConfig.gameInfo.versionType;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.profileProperties = gameConfig.userInfo.profileProperties;
    this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()});
    LOGGER.debug("(Session ID is {})", new Object[] {this.session.getSessionID()});
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = null;

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
    this.dataFixer = DataFixesManager.createFixer();
    
    //-ZMod-core----------------------------------------------------------
    ZHandle.onMinecraftInit(this);
    //--------------------------------------------------------------------
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:39,代码来源:Minecraft.java

示例10: Minecraft

public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.versionType = gameConfig.gameInfo.versionType;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.profileProperties = gameConfig.userInfo.profileProperties;
    this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()});
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = null;

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
    this.dataFixer = DataFixesManager.createFixer();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:34,代码来源:Minecraft.java

示例11: Minecraft

public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.field_181038_N = gameConfig.userInfo.field_181172_c;
    this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex)).getResourceMap());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    logger.info("Setting user: " + this.session.getUsername());
    logger.info("(Session ID is " + this.session.getSessionID() + ")");
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = new IntegratedServer(this);

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:33,代码来源:Minecraft.java

示例12: NetworkInterfaceAwareSocketFactory

/**
 * @param blacklisted Network interface names to ignore
 * @param proxy       Proxy or null for direct connection
 */
public NetworkInterfaceAwareSocketFactory(final SocketFactory delegate, final List<String> blacklisted, final java.net.Proxy proxy) {
    this.delegate = delegate;
    this.blacklisted = blacklisted;
    this.proxy = null == proxy ? Proxy.NO_PROXY : proxy;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:9,代码来源:NetworkInterfaceAwareSocketFactory.java

示例13: addressWithProxyToString

@Test public void addressWithProxyToString() throws Exception {
  Address address = new Address("square.com", 80, dns, socketFactory, null, null, null,
      authenticator, Proxy.NO_PROXY, protocols, connectionSpecs, proxySelector);
  assertEquals("Address{square.com:80, proxy=" + Proxy.NO_PROXY + "}", address.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:AddressTest.java

示例14: post

/**
 * Sends a POST to the given URL
 */
private static String post(URL url, String content, boolean skipLoggingErrors, @Nullable Proxy p_151225_3_)
{
    try
    {
        if (p_151225_3_ == null)
        {
            p_151225_3_ = Proxy.NO_PROXY;
        }

        HttpURLConnection httpurlconnection = (HttpURLConnection)url.openConnection(p_151225_3_);
        httpurlconnection.setRequestMethod("POST");
        httpurlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        httpurlconnection.setRequestProperty("Content-Length", "" + content.getBytes().length);
        httpurlconnection.setRequestProperty("Content-Language", "en-US");
        httpurlconnection.setUseCaches(false);
        httpurlconnection.setDoInput(true);
        httpurlconnection.setDoOutput(true);
        DataOutputStream dataoutputstream = new DataOutputStream(httpurlconnection.getOutputStream());
        dataoutputstream.writeBytes(content);
        dataoutputstream.flush();
        dataoutputstream.close();
        BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(httpurlconnection.getInputStream()));
        StringBuffer stringbuffer = new StringBuffer();
        String s;

        while ((s = bufferedreader.readLine()) != null)
        {
            stringbuffer.append(s);
            stringbuffer.append('\r');
        }

        bufferedreader.close();
        return stringbuffer.toString();
    }
    catch (Exception exception)
    {
        if (!skipLoggingErrors)
        {
            LOGGER.error("Could not post to {}", new Object[] {url, exception});
        }

        return "";
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:47,代码来源:HttpUtil.java

示例15: getProxy

public Proxy getProxy() {
    return type == MyProxyType.DIRECT ? 
        Proxy.NO_PROXY : 
        new Proxy(type.getType(), new InetSocketAddress(host, port));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:MyProxy.java


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