|
15 | 15 | */
|
16 | 16 | package net.schmizz.sshj;
|
17 | 17 |
|
18 |
| -import com.hierynomus.sshj.backport.JavaVersion; |
19 |
| -import com.hierynomus.sshj.backport.Jdk7HttpProxySocket; |
20 | 18 | import net.schmizz.sshj.connection.channel.Channel;
|
21 | 19 | import net.schmizz.sshj.connection.channel.direct.DirectConnection;
|
22 | 20 |
|
|
26 | 24 | import java.io.OutputStream;
|
27 | 25 | import java.net.InetAddress;
|
28 | 26 | import java.net.InetSocketAddress;
|
29 |
| -import java.net.Proxy; |
30 | 27 | import java.net.Socket;
|
31 | 28 |
|
32 | 29 | public abstract class SocketClient {
|
@@ -57,73 +54,6 @@ protected InetSocketAddress makeInetSocketAddress(String hostname, int port) {
|
57 | 54 | return new InetSocketAddress(hostname, port);
|
58 | 55 | }
|
59 | 56 |
|
60 |
| - /** |
61 |
| - * Connect to a host via a proxy. |
62 |
| - * @param hostname The host name to connect to. |
63 |
| - * @param proxy The proxy to connect via. |
64 |
| - * @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory} |
65 |
| - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. |
66 |
| - */ |
67 |
| - @Deprecated |
68 |
| - public void connect(String hostname, Proxy proxy) throws IOException { |
69 |
| - connect(hostname, defaultPort, proxy); |
70 |
| - } |
71 |
| - |
72 |
| - /** |
73 |
| - * Connect to a host via a proxy. |
74 |
| - * @param hostname The host name to connect to. |
75 |
| - * @param port The port to connect to. |
76 |
| - * @param proxy The proxy to connect via. |
77 |
| - * @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory} |
78 |
| - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. |
79 |
| - */ |
80 |
| - @Deprecated |
81 |
| - public void connect(String hostname, int port, Proxy proxy) throws IOException { |
82 |
| - this.hostname = hostname; |
83 |
| - this.port = port; |
84 |
| - if (JavaVersion.isJava7OrEarlier() && proxy.type() == Proxy.Type.HTTP) { |
85 |
| - // Java7 and earlier have no support for HTTP Connect proxies, return our custom socket. |
86 |
| - socket = new Jdk7HttpProxySocket(proxy); |
87 |
| - } else { |
88 |
| - socket = new Socket(proxy); |
89 |
| - } |
90 |
| - socket.connect(makeInetSocketAddress(hostname, port), connectTimeout); |
91 |
| - onConnect(); |
92 |
| - } |
93 |
| - |
94 |
| - /** |
95 |
| - * Connect to a host via a proxy. |
96 |
| - * @param host The host address to connect to. |
97 |
| - * @param proxy The proxy to connect via. |
98 |
| - * @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory} |
99 |
| - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. |
100 |
| - */ |
101 |
| - @Deprecated |
102 |
| - public void connect(InetAddress host, Proxy proxy) throws IOException { |
103 |
| - connect(host, defaultPort, proxy); |
104 |
| - } |
105 |
| - |
106 |
| - /** |
107 |
| - * Connect to a host via a proxy. |
108 |
| - * @param host The host address to connect to. |
109 |
| - * @param port The port to connect to. |
110 |
| - * @param proxy The proxy to connect via. |
111 |
| - * @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory} |
112 |
| - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. |
113 |
| - */ |
114 |
| - @Deprecated |
115 |
| - public void connect(InetAddress host, int port, Proxy proxy) throws IOException { |
116 |
| - this.port = port; |
117 |
| - if (JavaVersion.isJava7OrEarlier() && proxy.type() == Proxy.Type.HTTP) { |
118 |
| - // Java7 and earlier have no support for HTTP Connect proxies, return our custom socket. |
119 |
| - socket = new Jdk7HttpProxySocket(proxy); |
120 |
| - } else { |
121 |
| - socket = new Socket(proxy); |
122 |
| - } |
123 |
| - socket.connect(new InetSocketAddress(host, port), connectTimeout); |
124 |
| - onConnect(); |
125 |
| - } |
126 |
| - |
127 | 57 | public void connect(String hostname) throws IOException {
|
128 | 58 | connect(hostname, defaultPort);
|
129 | 59 | }
|
|
0 commit comments