Alter Loader to allow configuration from Properties object. Server can now be obtained from Loader.

This commit is contained in:
2015-03-21 21:09:34 +00:00
parent 54cc7dc65f
commit 5dc25b8858
9 changed files with 137 additions and 75 deletions

View File

@@ -0,0 +1,39 @@
package test;
import java.util.Properties;
import com.github.boukefalos.ibuddy.Loader;
import com.github.boukefalos.ibuddy.iBuddy;
import com.github.boukefalos.ibuddy.server.Server;
public class TestCommunication {
public static void main(String[] args) {
try {
Properties localProperties = new Properties();
localProperties.setProperty("implementation", "local");
localProperties.setProperty("server", "true");
localProperties.setProperty("server.port", "8883");
Properties remoteProperties = new Properties();
remoteProperties.setProperty("implementation", "remote");
remoteProperties.setProperty("remote.host", "localhost");
remoteProperties.setProperty("remote.port", "8883");
Loader localLoader = new Loader(localProperties);
Loader remoteLoader = new Loader(remoteProperties);
iBuddy localiBuddy = localLoader.getiBuddy();
iBuddy remoteiBuddy = remoteLoader.getiBuddy();
localiBuddy.test();
Server server = localLoader.getServer();
server.start();
remoteiBuddy.setHeadGreen(true);
Thread.sleep(10000);
} catch (Exception e) {
e.printStackTrace();
}
}
}