blob: cf9e150194b0e9b34454351284f670d629296e5a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package com.btr.proxy.selector.direct;
import java.io.IOException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.util.List;
import com.btr.proxy.util.ProxyUtil;
/*****************************************************************************
* This proxy selector will always return a "DIRECT" proxy.
* Implemented as singleton.
*
* @author Bernd Rosstauscher (proxyvole@rosstauscher.de) Copyright 2009
****************************************************************************/
public class NoProxySelector extends ProxySelector {
private static NoProxySelector instance;
/*************************************************************************
* Constructor
************************************************************************/
private NoProxySelector() {
super();
}
/*************************************************************************
* Gets the one and only instance of this selector.
* @return a DirectSelector.
************************************************************************/
public static synchronized NoProxySelector getInstance() {
if (NoProxySelector.instance == null) {
NoProxySelector.instance = new NoProxySelector();
}
return instance;
}
/*************************************************************************
* connectFailed
* @see java.net.ProxySelector#connectFailed(java.net.URI, java.net.SocketAddress, java.io.IOException)
************************************************************************/
@Override
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
// Not used.
}
/*************************************************************************
* select
* @see java.net.ProxySelector#select(java.net.URI)
************************************************************************/
@Override
public List<Proxy> select(URI uri) {
return ProxyUtil.noProxyList();
}
}
/*
* $Log: $
*/
|