Updated example for removed connect() methods
This commit is contained in:
parent
689f59312f
commit
bbe2909411
|
|
@ -1,5 +1,6 @@
|
||||||
package examples;
|
package examples;
|
||||||
|
|
||||||
|
import javax.net.SocketFactory;
|
||||||
import me.legrange.mikrotik.ApiConnection;
|
import me.legrange.mikrotik.ApiConnection;
|
||||||
import me.legrange.mikrotik.MikrotikApiException;
|
import me.legrange.mikrotik.MikrotikApiException;
|
||||||
|
|
||||||
|
|
@ -16,7 +17,7 @@ public class TryWithResources {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void test() throws MikrotikApiException, InterruptedException {
|
private void test() throws MikrotikApiException, InterruptedException {
|
||||||
try (ApiConnection con = ApiConnection.connect(Config.HOST, ApiConnection.DEFAULT_PORT, 2000)) {
|
try (ApiConnection con = ApiConnection.connect(SocketFactory.getDefault(), Config.HOST, ApiConnection.DEFAULT_PORT, 2000)) {
|
||||||
con.login(Config.USERNAME, Config.PASSWORD);
|
con.login(Config.USERNAME, Config.PASSWORD);
|
||||||
con.execute("/user/add name=eric");
|
con.execute("/user/add name=eric");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue