Skip to content

Commit f6ab16f

Browse files
committed
Backwards compatibility
1 parent 54ba802 commit f6ab16f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/main/java/org/bbottema/javasocksproxyserver/SocksServer.java

+19-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ public class SocksServer {
1515
private static final Logger LOGGER = LoggerFactory.getLogger(SocksServer.class);
1616

1717
private volatile boolean stopped = false;
18-
private final int listenPort;
18+
private int listenPort;
1919

20-
private final ServerSocketFactory factory;
20+
private ServerSocketFactory factory;
2121
private Authenticator authenticator = null;
2222

23+
public SocksServer() {
24+
listenPort = 1080;
25+
factory = ServerSocketFactory.getDefault();
26+
}
27+
2328
public SocksServer(int listenPort) {
2429
this.listenPort = listenPort;
2530
factory = ServerSocketFactory.getDefault();
@@ -35,6 +40,18 @@ public SocksServer setAuthenticator(Authenticator authenticator) {
3540
return this;
3641
}
3742

43+
@Deprecated
44+
public synchronized void start(int port) {
45+
start(port, ServerSocketFactory.getDefault());
46+
}
47+
48+
@Deprecated
49+
public synchronized void start(int port, ServerSocketFactory factory) {
50+
listenPort = port;
51+
this.factory = factory;
52+
start();
53+
}
54+
3855
public synchronized SocksServer start() {
3956
stopped = false;
4057
new Thread(new ServerProcess(listenPort, factory, authenticator)).start();

0 commit comments

Comments
 (0)