本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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));
}
示例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://";
}
}
示例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)
{
;
}
}
}
};
}
示例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)
{
;
}
}
}
};
}
示例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");
}
}
示例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);
//--------------------------------------------------------------------
}
示例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();
}
示例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();
}
示例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;
}
示例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());
}
示例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 "";
}
}
示例15: getProxy
public Proxy getProxy() {
return type == MyProxyType.DIRECT ?
Proxy.NO_PROXY :
new Proxy(type.getType(), new InetSocketAddress(host, port));
}