Replace tabs with spaces

This commit is contained in:
2015-09-01 13:19:18 +01:00
parent b422958f5d
commit b6bfa4e7c1
13 changed files with 316 additions and 316 deletions

View File

@@ -4,7 +4,7 @@ import base.Control;
import base.work.Listen; import base.work.Listen;
public interface Lirc extends Control { public interface Lirc extends Control {
public void register(Listen<Object> listen); public void register(Listen<Object> listen);
public void remove(Listen<Object> listen); public void remove(Listen<Object> listen);
//public void send(String remote, String code); //public void send(String remote, String code);
} }

View File

@@ -20,12 +20,12 @@ public class LircButton {
public String remote; public String remote;
public String code; public String code;
public LircButton(String remote, String code) { public LircButton(String remote, String code) {
this.remote = remote; this.remote = remote;
this.code = code; this.code = code;
} }
public lirc.Lirc.LircButton getProto() { public lirc.Lirc.LircButton getProto() {
return lirc.Lirc.LircButton.newBuilder().setRemote(remote).setCode(code).build(); return lirc.Lirc.LircButton.newBuilder().setRemote(remote).setCode(code).build();
} }
} }

View File

@@ -22,19 +22,19 @@ import base.server.channel.TcpClient;
import base.work.Listen; import base.work.Listen;
public class LircClient extends TcpClient { public class LircClient extends TcpClient {
public static final int BUFFER_SIZE = 1024; public static final int BUFFER_SIZE = 1024;
public static final String IP = "localhost"; public static final String IP = "localhost";
public static final int PORT = 8765; public static final int PORT = 8765;
protected String send; protected String send;
protected Listen<Object> listen; protected Listen<Object> listen;
public LircClient(Listen<Object> listen) { public LircClient(Listen<Object> listen) {
super(IP, PORT, BUFFER_SIZE); super(IP, PORT, BUFFER_SIZE);
//send = Native.getValue(Registry.CURRENT_USER, "Software\\LIRC", "password"); //send = Native.getValue(Registry.CURRENT_USER, "Software\\LIRC", "password");
this.listen = listen; this.listen = listen;
} }
public void send(LircButton button) { public void send(LircButton button) {
send(button, 0); send(button, 0);
} }
@@ -44,13 +44,13 @@ public class LircClient extends TcpClient {
} }
String command = String.format("%s %s %s \n", send, lircButton.remote, lircButton.code); String command = String.format("%s %s %s \n", send, lircButton.remote, lircButton.code);
try { try {
send(command.getBytes()); send(command.getBytes());
} catch (IOException e) { } catch (IOException e) {
logger.error("", e); logger.error("", e);
} }
} }
public void input(byte[] buffer) { public void input(byte[] buffer) {
listen.add(buffer); listen.add(buffer);
} }
} }

View File

@@ -11,50 +11,50 @@ import com.github.boukefalos.lirc.implementation.Remote;
public class Loader extends AbstractLoader<Loader> { public class Loader extends AbstractLoader<Loader> {
protected static final String PROPERTIES_FILE = "lirc.properties"; protected static final String PROPERTIES_FILE = "lirc.properties";
public Loader(Properties properties) throws LoaderException { public Loader(Properties properties) throws LoaderException {
super(); super();
/* Add implementation */ /* Add implementation */
switch (properties.getProperty("implementation")) { switch (properties.getProperty("implementation")) {
case "local": case "local":
pico.addComponent(Local.class); pico.addComponent(Local.class);
break; break;
case "remote": case "remote":
pico.addComponent(Remote.class); pico.addComponent(Remote.class);
/* Add remote forwarder implementation */ /* Add remote forwarder implementation */
try { try {
String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); String protocol = properties.getOrDefault("server.protocol", "tcp").toString();
String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); String implementation = properties.getOrDefault("tcp.implementation", "socket").toString();
int port = Integer.valueOf(properties.getProperty("remote.port")); int port = Integer.valueOf(properties.getProperty("remote.port"));
addServerForwarder(protocol, implementation, port); addServerForwarder(protocol, implementation, port);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new LoaderException("Failed to parse remote.port"); throw new LoaderException("Failed to parse remote.port");
} }
break; break;
} }
/* Add server */ /* Add server */
if (properties.getProperty("server") != null) { if (properties.getProperty("server") != null) {
pico.addComponent(Server.class); pico.addComponent(Server.class);
/* Add sender implementation */ /* Add sender implementation */
try { try {
String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); String protocol = properties.getOrDefault("server.protocol", "tcp").toString();
String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); String implementation = properties.getOrDefault("tcp.implementation", "socket").toString();
int port = Integer.valueOf(properties.getProperty("server.port")); int port = Integer.valueOf(properties.getProperty("server.port"));
addServerSender(protocol, implementation, port); addServerSender(protocol, implementation, port);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new LoaderException("Failed to parse server.port"); throw new LoaderException("Failed to parse server.port");
} }
} }
} }
public Lirc getLirc() { public Lirc getLirc() {
return pico.getComponent(Lirc.class); return pico.getComponent(Lirc.class);
} }
public Server getServer() { public Server getServer() {
return pico.getComponent(Server.class); return pico.getComponent(Server.class);
} }
} }

View File

@@ -22,59 +22,59 @@ import base.work.Listen;
import com.github.boukefalos.lirc.util.SignalObject; import com.github.boukefalos.lirc.util.SignalObject;
public class Server extends Listen<Object> implements Control { public class Server extends Listen<Object> implements Control {
protected Lirc lirc; protected Lirc lirc;
protected Sender sender; protected Sender sender;
public Server(Lirc lirc, Sender sender) { public Server(Lirc lirc, Sender sender) {
this.lirc = lirc; this.lirc = lirc;
this.sender = sender; this.sender = sender;
lirc.register(this); lirc.register(this);
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
lirc.start(); lirc.start();
sender.start(); sender.start();
super.activate(); super.activate();
} }
public void deactivate() throws DeactivateException { public void deactivate() throws DeactivateException {
super.deactivate(); super.deactivate();
lirc.start(); lirc.start();
sender.stop(); sender.stop();
} }
public void exit() { public void exit() {
lirc.exit(); lirc.exit();
sender.exit(); sender.exit();
} }
public void input(SignalObject<Object> signalObject) { public void input(SignalObject<Object> signalObject) {
Signal signal = signalObject.signal; Signal signal = signalObject.signal;
Object object = signalObject.object; Object object = signalObject.object;
Builder builder = Button.newBuilder().setSignal(signal); Builder builder = Button.newBuilder().setSignal(signal);
if (object instanceof LircButton) { if (object instanceof LircButton) {
builder.setType(Type.LIRC); builder.setType(Type.LIRC);
LircButton lircButton = (LircButton) object; LircButton lircButton = (LircButton) object;
builder.setLircButton(lircButton.getProto()); builder.setLircButton(lircButton.getProto());
} else if (object instanceof Color) { } else if (object instanceof Color) {
builder.setType(Type.COLOR); builder.setType(Type.COLOR);
Color color = (Color) object; Color color = (Color) object;
builder.setColorButton(ColorButton.newBuilder().setColor(color)); builder.setColorButton(ColorButton.newBuilder().setColor(color));
} else if (object instanceof Number) { } else if (object instanceof Number) {
builder.setType(Type.NUMBER); builder.setType(Type.NUMBER);
Number number = (Number) object; Number number = (Number) object;
builder.setNumberButton(NumberButton.newBuilder().setNumber(number)); builder.setNumberButton(NumberButton.newBuilder().setNumber(number));
} else if (object instanceof Direction) { } else if (object instanceof Direction) {
builder.setType(Type.DIRECTION); builder.setType(Type.DIRECTION);
Direction direction = (Direction) object; Direction direction = (Direction) object;
builder.setDirectionButton(DirectionButton.newBuilder().setDirection(direction)); builder.setDirectionButton(DirectionButton.newBuilder().setDirection(direction));
} }
ByteArrayOutputStream output = new ByteArrayOutputStream(1024); ByteArrayOutputStream output = new ByteArrayOutputStream(1024);
try { try {
builder.build().writeDelimitedTo(output); builder.build().writeDelimitedTo(output);
sender.send(output.toByteArray()); sender.send(output.toByteArray());
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to send command"); logger.error("Failed to send command");
} }
} }
} }

View File

@@ -34,27 +34,27 @@ import com.github.boukefalos.lirc.util.Multiplexer;
import com.github.boukefalos.lirc.util.SignalObject; import com.github.boukefalos.lirc.util.SignalObject;
public class Local extends Listen<Object> implements Lirc { public class Local extends Listen<Object> implements Lirc {
protected ArrayList<Listen<Object>> listenList; protected ArrayList<Listen<Object>> listenList;
protected Multiplexer<String> multiplexer; protected Multiplexer<String> multiplexer;
protected LircClient lircClient; protected LircClient lircClient;
public Local() { public Local() {
listenList = new ArrayList<Listen<Object>>(); listenList = new ArrayList<Listen<Object>>();
lircClient = new LircClient(this); lircClient = new LircClient(this);
multiplexer = new Multiplexer<String>(); multiplexer = new Multiplexer<String>();
multiplexer.register(this); multiplexer.register(this);
} }
public void register(Listen<Object> listen) { public void register(Listen<Object> listen) {
listenList.add(listen); listenList.add(listen);
} }
public void remove(Listen<Object> listen) { public void remove(Listen<Object> listen) {
listenList.remove(listen); listenList.remove(listen);
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
lircClient.start(); lircClient.start();
super.activate(); super.activate();
} }
@@ -70,54 +70,54 @@ public class Local extends Listen<Object> implements Lirc {
multiplexer.exit(); multiplexer.exit();
} }
public void input(byte[] buffer) { public void input(byte[] buffer) {
String line = new String(buffer).trim(); String line = new String(buffer).trim();
if (!line.startsWith("BEGIN")) { if (!line.startsWith("BEGIN")) {
Scanner scanner = new Scanner(line); Scanner scanner = new Scanner(line);
scanner.next(); scanner.next();
scanner.next(); scanner.next();
String code = scanner.next(); String code = scanner.next();
String remote = scanner.next(); String remote = scanner.next();
// Need to pass as String to assure consistent hash // Need to pass as String to assure consistent hash
multiplexer.add(remote + " " + code); multiplexer.add(remote + " " + code);
scanner.close(); scanner.close();
} }
} }
public void input(SignalObject<Object> signalObject) { public void input(SignalObject<Object> signalObject) {
Object object = signalObject.object; Object object = signalObject.object;
if (object instanceof String) { if (object instanceof String) {
// Translate String signal objects to LircButton signalObjects // Translate String signal objects to LircButton signalObjects
String[] input = ((String) object).split(" "); String[] input = ((String) object).split(" ");
LircButton lircButton = new LircButton(input[0], input[1]); LircButton lircButton = new LircButton(input[0], input[1]);
signalObject = new SignalObject<Object>(signalObject.signal, lircButton); signalObject = new SignalObject<Object>(signalObject.signal, lircButton);
otherParsings(signalObject.signal, input[1].toUpperCase()); otherParsings(signalObject.signal, input[1].toUpperCase());
} }
// Pass signalObject to listens // Pass signalObject to listens
for (Listen<Object> listen : listenList) { for (Listen<Object> listen : listenList) {
listen.add(signalObject); listen.add(signalObject);
} }
} }
protected void otherParsings(Signal signal, String code) { protected void otherParsings(Signal signal, String code) {
for (Color color : Color.values()) { for (Color color : Color.values()) {
if (color.toString().equals(code)) { if (color.toString().equals(code)) {
add(new SignalObject<Color>(signal, color)); add(new SignalObject<Color>(signal, color));
} }
} }
for (Number number : Number.values()) { for (Number number : Number.values()) {
if (number.toString().equals(code)) { if (number.toString().equals(code)) {
add(new SignalObject<Number>(signal, number)); add(new SignalObject<Number>(signal, number));
} }
} }
for (Direction direction : Direction.values()) { for (Direction direction : Direction.values()) {
if (direction.toString().equals(code)) { if (direction.toString().equals(code)) {
add(new SignalObject<Direction>(signal, direction)); add(new SignalObject<Direction>(signal, direction));
} }
} }
try { try {
add(new SignalObject<Number>(signal, Number.valueOf(Integer.valueOf(code)))); add(new SignalObject<Number>(signal, Number.valueOf(Integer.valueOf(code))));
} catch (NumberFormatException e) {} } catch (NumberFormatException e) {}
} }
} }

View File

@@ -19,55 +19,55 @@ import com.github.boukefalos.lirc.LircButton;
import com.github.boukefalos.lirc.util.SignalObject; import com.github.boukefalos.lirc.util.SignalObject;
public class Remote extends AbstractReceiver implements Lirc { public class Remote extends AbstractReceiver implements Lirc {
protected ArrayList<Listen<Object>> listenList; protected ArrayList<Listen<Object>> listenList;
public Remote(Forwarder forwarder) { public Remote(Forwarder forwarder) {
super(forwarder); super(forwarder);
listenList = new ArrayList<Listen<Object>>(); listenList = new ArrayList<Listen<Object>>();
} }
public void register(Listen<Object> listen) { public void register(Listen<Object> listen) {
listenList.add(listen); listenList.add(listen);
} }
public void remove(Listen<Object> listen) { public void remove(Listen<Object> listen) {
listenList.remove(listen); listenList.remove(listen);
} }
public void receive(byte[] buffer) { public void receive(byte[] buffer) {
Object object = decode(buffer); Object object = decode(buffer);
if (object != null) { if (object != null) {
for (Listen<Object> listen : listenList) { for (Listen<Object> listen : listenList) {
listen.add(object); listen.add(object);
} }
} }
} }
public SignalObject<?> decode(byte[] buffer) { public SignalObject<?> decode(byte[] buffer) {
ByteArrayInputStream input = new ByteArrayInputStream(buffer); ByteArrayInputStream input = new ByteArrayInputStream(buffer);
try { try {
Button button = Button.parseDelimitedFrom(input); Button button = Button.parseDelimitedFrom(input);
Type type = button.getType(); Type type = button.getType();
Signal signal = button.getSignal(); Signal signal = button.getSignal();
switch (type) { switch (type) {
case COLOR: case COLOR:
Color color = button.getColorButton().getColor(); Color color = button.getColorButton().getColor();
return new SignalObject<Color>(signal, color); return new SignalObject<Color>(signal, color);
case DIRECTION: case DIRECTION:
Direction direction = button.getDirectionButton().getDirection(); Direction direction = button.getDirectionButton().getDirection();
return new SignalObject<Direction>(signal, direction); return new SignalObject<Direction>(signal, direction);
case NUMBER: case NUMBER:
Number number = button.getNumberButton().getNumber(); Number number = button.getNumberButton().getNumber();
return new SignalObject<Number>(signal, number); return new SignalObject<Number>(signal, number);
case LIRC: case LIRC:
String remote = button.getLircButton().getRemote(); String remote = button.getLircButton().getRemote();
String code = button.getLircButton().getCode(); String code = button.getLircButton().getCode();
LircButton lircButton = new LircButton(remote, code); LircButton lircButton = new LircButton(remote, code);
return new SignalObject<LircButton>(signal, lircButton); return new SignalObject<LircButton>(signal, lircButton);
} }
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to parse input"); logger.error("Failed to parse input");
} }
return null; return null;
} }
} }

View File

@@ -30,7 +30,7 @@ public class Multiplexer<T> {
protected int timeout; protected int timeout;
protected ArrayList<Listen<Object>> listenList; protected ArrayList<Listen<Object>> listenList;
protected ScheduledExecutorService executor; protected ScheduledExecutorService executor;
protected HashMap<T,Integer> counterMap; protected HashMap<T,Integer> counterMap;
public Multiplexer() { public Multiplexer() {
@@ -38,63 +38,63 @@ public class Multiplexer<T> {
} }
public Multiplexer(int timeout) { public Multiplexer(int timeout) {
this.timeout = timeout; this.timeout = timeout;
listenList = new ArrayList<Listen<Object>>(); listenList = new ArrayList<Listen<Object>>();
executor = Executors.newSingleThreadScheduledExecutor(); executor = Executors.newSingleThreadScheduledExecutor();
counterMap = new HashMap<T,Integer>(); counterMap = new HashMap<T,Integer>();
} }
public void register(Listen<Object> listen) { public void register(Listen<Object> listen) {
listenList.add(listen); listenList.add(listen);
} }
public void remove(Listen<SignalObject<T>> listen) { public void remove(Listen<SignalObject<T>> listen) {
listenList.remove(listen); listenList.remove(listen);
} }
public synchronized void add(T object) { public synchronized void add(T object) {
Expire expire = new Expire(this, object); Expire expire = new Expire(this, object);
executor.schedule(expire, (long) timeout, TimeUnit.MILLISECONDS); executor.schedule(expire, (long) timeout, TimeUnit.MILLISECONDS);
int counter = counterMap.getOrDefault(object, 0); int counter = counterMap.getOrDefault(object, 0);
if (counter == 0) { if (counter == 0) {
for (Listen<Object> listen : listenList) { for (Listen<Object> listen : listenList) {
listen.add(new SignalObject<T>(Signal.BEGIN, object)); listen.add(new SignalObject<T>(Signal.BEGIN, object));
} }
} }
counterMap.put(object, counter + 1); counterMap.put(object, counter + 1);
} }
protected synchronized void expire(T object) { protected synchronized void expire(T object) {
int counter = counterMap.get(object); int counter = counterMap.get(object);
counterMap.put(object, counter - 1); counterMap.put(object, counter - 1);
if (counter == 1) { if (counter == 1) {
for (Listen<Object> listen : listenList) { for (Listen<Object> listen : listenList) {
listen.add(new SignalObject<T>(Signal.END, object)); listen.add(new SignalObject<T>(Signal.END, object));
} }
} }
} }
public class Expire implements Runnable { public class Expire implements Runnable {
protected Multiplexer<T> multiplexer; protected Multiplexer<T> multiplexer;
protected T object; protected T object;
public Expire(Multiplexer<T> multiplexer, T object) { public Expire(Multiplexer<T> multiplexer, T object) {
this.multiplexer = multiplexer; this.multiplexer = multiplexer;
this.object = object; this.object = object;
} }
public void run() { public void run() {
multiplexer.expire(object); multiplexer.expire(object);
} }
} }
public void stop() { public void stop() {
executor.shutdown(); executor.shutdown();
} }
public void exit() { public void exit() {
stop(); stop();
// Should cancel all scheduled Runnables // Should cancel all scheduled Runnables
} }
} }

View File

@@ -3,16 +3,16 @@ package com.github.boukefalos.lirc.util;
import lirc.Lirc.Signal; import lirc.Lirc.Signal;
public class SignalObject<T> { public class SignalObject<T> {
public Signal signal; public Signal signal;
public T object; public T object;
public SignalObject(Signal signal, T object) { public SignalObject(Signal signal, T object) {
this.signal = signal; this.signal = signal;
this.object = object; this.object = object;
} }
public String bla() { public String bla() {
return signal + " " + object; return signal + " " + object;
} }
} }

View File

@@ -9,37 +9,37 @@ import com.github.boukefalos.lirc.LircButton;
import com.github.boukefalos.lirc.implementation.Local; import com.github.boukefalos.lirc.implementation.Local;
import com.github.boukefalos.lirc.util.SignalObject; import com.github.boukefalos.lirc.util.SignalObject;
public class TestLocal extends Listen<Object> { public class TestLocal extends Listen<Object> {
public static void main(String[] args) { public static void main(String[] args) {
new TestLocal().start(); new TestLocal().start();
try { try {
Thread.sleep(1000000); Thread.sleep(1000000);
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
} }
protected Lirc lirc; protected Lirc lirc;
public TestLocal() { public TestLocal() {
lirc = new Local(); lirc = new Local();
lirc.register(this); lirc.register(this);
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
lirc.start(); lirc.start();
super.activate(); super.activate();
} }
public void start() { public void start() {
super.start(); super.start();
} }
public void input(SignalObject<LircButton> lircButtonSignal) { public void input(SignalObject<LircButton> lircButtonSignal) {
Object object = lircButtonSignal.object; Object object = lircButtonSignal.object;
if (object instanceof LircButton) { if (object instanceof LircButton) {
Signal signal = lircButtonSignal.signal; Signal signal = lircButtonSignal.signal;
LircButton lircButton = lircButtonSignal.object; LircButton lircButton = lircButtonSignal.object;
String code = lircButton.code; String code = lircButton.code;
logger.error(signal.name() + " : " + code + " @ " + lircButton.remote); logger.error(signal.name() + " : " + code + " @ " + lircButton.remote);
} }
} }
} }

View File

@@ -14,39 +14,39 @@ import com.github.boukefalos.lirc.Server;
import com.github.boukefalos.lirc.util.SignalObject; import com.github.boukefalos.lirc.util.SignalObject;
public class TestRemoteImplementation extends Listen<Object> { public class TestRemoteImplementation extends Listen<Object> {
protected Lirc lirc; protected Lirc lirc;
public TestRemoteImplementation(Loader loader) { public TestRemoteImplementation(Loader loader) {
lirc = loader.getLirc(); lirc = loader.getLirc();
lirc.register(this); lirc.register(this);
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
lirc.start(); lirc.start();
super.activate(); super.activate();
} }
public void input(SignalObject<LircButton> lircButtonSignal) { public void input(SignalObject<LircButton> lircButtonSignal) {
Object object = lircButtonSignal.object; Object object = lircButtonSignal.object;
if (object instanceof LircButton) { if (object instanceof LircButton) {
Signal signal = lircButtonSignal.signal; Signal signal = lircButtonSignal.signal;
LircButton lircButton = lircButtonSignal.object; LircButton lircButton = lircButtonSignal.object;
String code = lircButton.code; String code = lircButton.code;
logger.error(signal.name() + " : " + code + " @ " + lircButton.remote); logger.error(signal.name() + " : " + code + " @ " + lircButton.remote);
} }
} }
public static void main(Properties localProperties, Properties remoteProperties) throws LoaderException { public static void main(Properties localProperties, Properties remoteProperties) throws LoaderException {
Loader localLoader = new Loader(localProperties); Loader localLoader = new Loader(localProperties);
Loader remoteLoader = new Loader(remoteProperties); Loader remoteLoader = new Loader(remoteProperties);
Server server = localLoader.getServer(); Server server = localLoader.getServer();
server.start(); server.start();
new TestRemoteImplementation(remoteLoader).start(); new TestRemoteImplementation(remoteLoader).start();
try { try {
Thread.sleep(1000000); Thread.sleep(1000000);
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
} }
} }

View File

@@ -5,19 +5,19 @@ import java.util.Properties;
import base.exception.LoaderException; import base.exception.LoaderException;
public class TestTcpImplementation { public class TestTcpImplementation {
public static void main(String[] args) throws LoaderException { public static void main(String[] args) throws LoaderException {
Properties localProperties = new Properties(); Properties localProperties = new Properties();
localProperties.setProperty("implementation", "local"); localProperties.setProperty("implementation", "local");
localProperties.setProperty("server", "true"); localProperties.setProperty("server", "true");
localProperties.setProperty("server.port", "8883"); localProperties.setProperty("server.port", "8883");
localProperties.setProperty("server.protocol", "tcp"); localProperties.setProperty("server.protocol", "tcp");
Properties remoteProperties = new Properties(); Properties remoteProperties = new Properties();
remoteProperties.setProperty("implementation", "remote"); remoteProperties.setProperty("implementation", "remote");
remoteProperties.setProperty("protocol", "tcp"); remoteProperties.setProperty("protocol", "tcp");
remoteProperties.setProperty("remote.host", "localhost"); remoteProperties.setProperty("remote.host", "localhost");
remoteProperties.setProperty("remote.port", "8883"); remoteProperties.setProperty("remote.port", "8883");
TestRemoteImplementation.main(localProperties, remoteProperties); TestRemoteImplementation.main(localProperties, remoteProperties);
} }
} }

View File

@@ -5,19 +5,19 @@ import java.util.Properties;
import base.exception.LoaderException; import base.exception.LoaderException;
public class TestUdpImplementation { public class TestUdpImplementation {
public static void main(String[] args) throws LoaderException { public static void main(String[] args) throws LoaderException {
Properties localProperties = new Properties(); Properties localProperties = new Properties();
localProperties.setProperty("implementation", "local"); localProperties.setProperty("implementation", "local");
localProperties.setProperty("server", "true"); localProperties.setProperty("server", "true");
localProperties.setProperty("server.port", "8883"); localProperties.setProperty("server.port", "8883");
localProperties.setProperty("server.protocol", "udp"); localProperties.setProperty("server.protocol", "udp");
Properties remoteProperties = new Properties(); Properties remoteProperties = new Properties();
remoteProperties.setProperty("implementation", "remote"); remoteProperties.setProperty("implementation", "remote");
remoteProperties.setProperty("protocol", "udp"); remoteProperties.setProperty("protocol", "udp");
remoteProperties.setProperty("remote.host", "localhost"); remoteProperties.setProperty("remote.host", "localhost");
remoteProperties.setProperty("remote.port", "8883"); remoteProperties.setProperty("remote.port", "8883");
TestRemoteImplementation.main(localProperties, remoteProperties); TestRemoteImplementation.main(localProperties, remoteProperties);
} }
} }