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