diff --git a/src/main/java/com/hierynomus/sshj/backport/JavaVersion.java b/src/main/java/com/hierynomus/sshj/backport/JavaVersion.java deleted file mode 100644 index 20ebac6a6..000000000 --- a/src/main/java/com/hierynomus/sshj/backport/JavaVersion.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C)2009 - SSHJ Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.hierynomus.sshj.backport; - -public class JavaVersion { - public static boolean isJava7OrEarlier() { - String property = System.getProperty("java.specification.version"); - float diff = Float.parseFloat(property) - 1.7f; - - return diff < 0.01; - } - -} diff --git a/src/main/java/net/schmizz/sshj/SocketClient.java b/src/main/java/net/schmizz/sshj/SocketClient.java index 8d916f734..d7971243a 100644 --- a/src/main/java/net/schmizz/sshj/SocketClient.java +++ b/src/main/java/net/schmizz/sshj/SocketClient.java @@ -15,8 +15,6 @@ */ package net.schmizz.sshj; -import com.hierynomus.sshj.backport.JavaVersion; -import com.hierynomus.sshj.backport.Jdk7HttpProxySocket; import net.schmizz.sshj.connection.channel.Channel; import net.schmizz.sshj.connection.channel.direct.DirectConnection; @@ -26,7 +24,6 @@ import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; -import java.net.Proxy; import java.net.Socket; public abstract class SocketClient { @@ -57,73 +54,6 @@ protected InetSocketAddress makeInetSocketAddress(String hostname, int port) { return new InetSocketAddress(hostname, port); } - /** - * Connect to a host via a proxy. - * @param hostname The host name to connect to. - * @param proxy The proxy to connect via. - * @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} - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. - */ - @Deprecated - public void connect(String hostname, Proxy proxy) throws IOException { - connect(hostname, defaultPort, proxy); - } - - /** - * Connect to a host via a proxy. - * @param hostname The host name to connect to. - * @param port The port to connect to. - * @param proxy The proxy to connect via. - * @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} - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. - */ - @Deprecated - public void connect(String hostname, int port, Proxy proxy) throws IOException { - this.hostname = hostname; - this.port = port; - if (JavaVersion.isJava7OrEarlier() && proxy.type() == Proxy.Type.HTTP) { - // Java7 and earlier have no support for HTTP Connect proxies, return our custom socket. - socket = new Jdk7HttpProxySocket(proxy); - } else { - socket = new Socket(proxy); - } - socket.connect(makeInetSocketAddress(hostname, port), connectTimeout); - onConnect(); - } - - /** - * Connect to a host via a proxy. - * @param host The host address to connect to. - * @param proxy The proxy to connect via. - * @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} - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. - */ - @Deprecated - public void connect(InetAddress host, Proxy proxy) throws IOException { - connect(host, defaultPort, proxy); - } - - /** - * Connect to a host via a proxy. - * @param host The host address to connect to. - * @param port The port to connect to. - * @param proxy The proxy to connect via. - * @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} - * into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor. - */ - @Deprecated - public void connect(InetAddress host, int port, Proxy proxy) throws IOException { - this.port = port; - if (JavaVersion.isJava7OrEarlier() && proxy.type() == Proxy.Type.HTTP) { - // Java7 and earlier have no support for HTTP Connect proxies, return our custom socket. - socket = new Jdk7HttpProxySocket(proxy); - } else { - socket = new Socket(proxy); - } - socket.connect(new InetSocketAddress(host, port), connectTimeout); - onConnect(); - } - public void connect(String hostname) throws IOException { connect(hostname, defaultPort); }