diff --git a/src/main/java/com/github/boukefalos/lirc/Lirc.java b/src/main/java/com/github/boukefalos/lirc/Lirc.java index 6dd51f5..3805061 100644 --- a/src/main/java/com/github/boukefalos/lirc/Lirc.java +++ b/src/main/java/com/github/boukefalos/lirc/Lirc.java @@ -4,7 +4,7 @@ import base.Control; import base.work.Listen; public interface Lirc extends Control { - public void register(Listen listen); - public void remove(Listen listen); - //public void send(String remote, String code); + public void register(Listen listen); + public void remove(Listen listen); + //public void send(String remote, String code); } diff --git a/src/main/java/com/github/boukefalos/lirc/LircButton.java b/src/main/java/com/github/boukefalos/lirc/LircButton.java index eaccede..bb12e91 100644 --- a/src/main/java/com/github/boukefalos/lirc/LircButton.java +++ b/src/main/java/com/github/boukefalos/lirc/LircButton.java @@ -20,12 +20,12 @@ public class LircButton { public String remote; public String code; - public LircButton(String remote, String code) { - this.remote = remote; - this.code = code; - } + public LircButton(String remote, String code) { + this.remote = remote; + this.code = code; + } - public lirc.Lirc.LircButton getProto() { - return lirc.Lirc.LircButton.newBuilder().setRemote(remote).setCode(code).build(); - } + public lirc.Lirc.LircButton getProto() { + return lirc.Lirc.LircButton.newBuilder().setRemote(remote).setCode(code).build(); + } } diff --git a/src/main/java/com/github/boukefalos/lirc/LircClient.java b/src/main/java/com/github/boukefalos/lirc/LircClient.java index 19ca4ed..4af8a16 100644 --- a/src/main/java/com/github/boukefalos/lirc/LircClient.java +++ b/src/main/java/com/github/boukefalos/lirc/LircClient.java @@ -22,19 +22,19 @@ import base.server.channel.TcpClient; import base.work.Listen; 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 int PORT = 8765; protected String send; - protected Listen listen; + protected Listen listen; public LircClient(Listen listen) { - super(IP, PORT, BUFFER_SIZE); + super(IP, PORT, BUFFER_SIZE); //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); } @@ -44,13 +44,13 @@ public class LircClient extends TcpClient { } String command = String.format("%s %s %s \n", send, lircButton.remote, lircButton.code); try { - send(command.getBytes()); - } catch (IOException e) { - logger.error("", e); - } + send(command.getBytes()); + } catch (IOException e) { + logger.error("", e); + } } public void input(byte[] buffer) { - listen.add(buffer); + listen.add(buffer); } } diff --git a/src/main/java/com/github/boukefalos/lirc/Loader.java b/src/main/java/com/github/boukefalos/lirc/Loader.java index bdbb832..d853908 100644 --- a/src/main/java/com/github/boukefalos/lirc/Loader.java +++ b/src/main/java/com/github/boukefalos/lirc/Loader.java @@ -11,50 +11,50 @@ import com.github.boukefalos.lirc.implementation.Remote; public class Loader extends AbstractLoader { protected static final String PROPERTIES_FILE = "lirc.properties"; - public Loader(Properties properties) throws LoaderException { - super(); + public Loader(Properties properties) throws LoaderException { + super(); - /* Add implementation */ - switch (properties.getProperty("implementation")) { - case "local": - pico.addComponent(Local.class); - break; - case "remote": - pico.addComponent(Remote.class); + /* Add implementation */ + switch (properties.getProperty("implementation")) { + case "local": + pico.addComponent(Local.class); + break; + case "remote": + pico.addComponent(Remote.class); - /* Add remote forwarder implementation */ - try { - String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); - String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); - int port = Integer.valueOf(properties.getProperty("remote.port")); - addServerForwarder(protocol, implementation, port); - } catch (NumberFormatException e) { - throw new LoaderException("Failed to parse remote.port"); - } - break; - } + /* Add remote forwarder implementation */ + try { + String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); + String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); + int port = Integer.valueOf(properties.getProperty("remote.port")); + addServerForwarder(protocol, implementation, port); + } catch (NumberFormatException e) { + throw new LoaderException("Failed to parse remote.port"); + } + break; + } - /* Add server */ - if (properties.getProperty("server") != null) { - pico.addComponent(Server.class); + /* Add server */ + if (properties.getProperty("server") != null) { + pico.addComponent(Server.class); - /* Add sender implementation */ - try { - String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); - String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); - int port = Integer.valueOf(properties.getProperty("server.port")); - addServerSender(protocol, implementation, port); - } catch (NumberFormatException e) { - throw new LoaderException("Failed to parse server.port"); - } - } - } + /* Add sender implementation */ + try { + String protocol = properties.getOrDefault("server.protocol", "tcp").toString(); + String implementation = properties.getOrDefault("tcp.implementation", "socket").toString(); + int port = Integer.valueOf(properties.getProperty("server.port")); + addServerSender(protocol, implementation, port); + } catch (NumberFormatException e) { + throw new LoaderException("Failed to parse server.port"); + } + } + } - public Lirc getLirc() { - return pico.getComponent(Lirc.class); + public Lirc getLirc() { + return pico.getComponent(Lirc.class); } public Server getServer() { - return pico.getComponent(Server.class); + return pico.getComponent(Server.class); } } diff --git a/src/main/java/com/github/boukefalos/lirc/Server.java b/src/main/java/com/github/boukefalos/lirc/Server.java index 6e0d668..56a9641 100644 --- a/src/main/java/com/github/boukefalos/lirc/Server.java +++ b/src/main/java/com/github/boukefalos/lirc/Server.java @@ -22,59 +22,59 @@ import base.work.Listen; import com.github.boukefalos.lirc.util.SignalObject; public class Server extends Listen implements Control { - protected Lirc lirc; - protected Sender sender; + protected Lirc lirc; + protected Sender sender; - public Server(Lirc lirc, Sender sender) { - this.lirc = lirc; - this.sender = sender; - lirc.register(this); - } + public Server(Lirc lirc, Sender sender) { + this.lirc = lirc; + this.sender = sender; + lirc.register(this); + } - public void activate() throws ActivateException { - lirc.start(); - sender.start(); - super.activate(); - } + public void activate() throws ActivateException { + lirc.start(); + sender.start(); + super.activate(); + } - public void deactivate() throws DeactivateException { - super.deactivate(); - lirc.start(); - sender.stop(); - } + public void deactivate() throws DeactivateException { + super.deactivate(); + lirc.start(); + sender.stop(); + } - public void exit() { - lirc.exit(); - sender.exit(); - } + public void exit() { + lirc.exit(); + sender.exit(); + } - public void input(SignalObject signalObject) { - Signal signal = signalObject.signal; - Object object = signalObject.object; - Builder builder = Button.newBuilder().setSignal(signal); - if (object instanceof LircButton) { - builder.setType(Type.LIRC); - LircButton lircButton = (LircButton) object; - builder.setLircButton(lircButton.getProto()); - } else if (object instanceof Color) { - builder.setType(Type.COLOR); - Color color = (Color) object; - builder.setColorButton(ColorButton.newBuilder().setColor(color)); - } else if (object instanceof Number) { - builder.setType(Type.NUMBER); - Number number = (Number) object; - builder.setNumberButton(NumberButton.newBuilder().setNumber(number)); - } else if (object instanceof Direction) { - builder.setType(Type.DIRECTION); - Direction direction = (Direction) object; - builder.setDirectionButton(DirectionButton.newBuilder().setDirection(direction)); - } - ByteArrayOutputStream output = new ByteArrayOutputStream(1024); - try { - builder.build().writeDelimitedTo(output); - sender.send(output.toByteArray()); - } catch (IOException e) { - logger.error("Failed to send command"); - } - } + public void input(SignalObject signalObject) { + Signal signal = signalObject.signal; + Object object = signalObject.object; + Builder builder = Button.newBuilder().setSignal(signal); + if (object instanceof LircButton) { + builder.setType(Type.LIRC); + LircButton lircButton = (LircButton) object; + builder.setLircButton(lircButton.getProto()); + } else if (object instanceof Color) { + builder.setType(Type.COLOR); + Color color = (Color) object; + builder.setColorButton(ColorButton.newBuilder().setColor(color)); + } else if (object instanceof Number) { + builder.setType(Type.NUMBER); + Number number = (Number) object; + builder.setNumberButton(NumberButton.newBuilder().setNumber(number)); + } else if (object instanceof Direction) { + builder.setType(Type.DIRECTION); + Direction direction = (Direction) object; + builder.setDirectionButton(DirectionButton.newBuilder().setDirection(direction)); + } + ByteArrayOutputStream output = new ByteArrayOutputStream(1024); + try { + builder.build().writeDelimitedTo(output); + sender.send(output.toByteArray()); + } catch (IOException e) { + logger.error("Failed to send command"); + } + } } diff --git a/src/main/java/com/github/boukefalos/lirc/implementation/Local.java b/src/main/java/com/github/boukefalos/lirc/implementation/Local.java index 5b42c0e..ce1273b 100644 --- a/src/main/java/com/github/boukefalos/lirc/implementation/Local.java +++ b/src/main/java/com/github/boukefalos/lirc/implementation/Local.java @@ -34,27 +34,27 @@ import com.github.boukefalos.lirc.util.Multiplexer; import com.github.boukefalos.lirc.util.SignalObject; public class Local extends Listen implements Lirc { - protected ArrayList> listenList; + protected ArrayList> listenList; protected Multiplexer multiplexer; protected LircClient lircClient; public Local() { - listenList = new ArrayList>(); + listenList = new ArrayList>(); lircClient = new LircClient(this); multiplexer = new Multiplexer(); multiplexer.register(this); } - public void register(Listen listen) { - listenList.add(listen); - } + public void register(Listen listen) { + listenList.add(listen); + } public void remove(Listen listen) { listenList.remove(listen); } public void activate() throws ActivateException { - lircClient.start(); + lircClient.start(); super.activate(); } @@ -70,54 +70,54 @@ public class Local extends Listen implements Lirc { multiplexer.exit(); } - public void input(byte[] buffer) { - String line = new String(buffer).trim(); - if (!line.startsWith("BEGIN")) { - Scanner scanner = new Scanner(line); + public void input(byte[] buffer) { + String line = new String(buffer).trim(); + if (!line.startsWith("BEGIN")) { + Scanner scanner = new Scanner(line); scanner.next(); scanner.next(); String code = scanner.next(); String remote = scanner.next(); - // Need to pass as String to assure consistent hash - multiplexer.add(remote + " " + code); - scanner.close(); + // Need to pass as String to assure consistent hash + multiplexer.add(remote + " " + code); + scanner.close(); } - } + } - public void input(SignalObject signalObject) { - Object object = signalObject.object; - if (object instanceof String) { - // Translate String signal objects to LircButton signalObjects - String[] input = ((String) object).split(" "); - LircButton lircButton = new LircButton(input[0], input[1]); - signalObject = new SignalObject(signalObject.signal, lircButton); - otherParsings(signalObject.signal, input[1].toUpperCase()); - } - // Pass signalObject to listens + public void input(SignalObject signalObject) { + Object object = signalObject.object; + if (object instanceof String) { + // Translate String signal objects to LircButton signalObjects + String[] input = ((String) object).split(" "); + LircButton lircButton = new LircButton(input[0], input[1]); + signalObject = new SignalObject(signalObject.signal, lircButton); + otherParsings(signalObject.signal, input[1].toUpperCase()); + } + // Pass signalObject to listens for (Listen 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()) { if (color.toString().equals(code)) { - add(new SignalObject(signal, color)); + add(new SignalObject(signal, color)); } } for (Number number : Number.values()) { if (number.toString().equals(code)) { - add(new SignalObject(signal, number)); + add(new SignalObject(signal, number)); } } for (Direction direction : Direction.values()) { if (direction.toString().equals(code)) { - add(new SignalObject(signal, direction)); + add(new SignalObject(signal, direction)); } } try { - add(new SignalObject(signal, Number.valueOf(Integer.valueOf(code)))); + add(new SignalObject(signal, Number.valueOf(Integer.valueOf(code)))); } catch (NumberFormatException e) {} - } + } } diff --git a/src/main/java/com/github/boukefalos/lirc/implementation/Remote.java b/src/main/java/com/github/boukefalos/lirc/implementation/Remote.java index c10208d..19e4377 100644 --- a/src/main/java/com/github/boukefalos/lirc/implementation/Remote.java +++ b/src/main/java/com/github/boukefalos/lirc/implementation/Remote.java @@ -19,55 +19,55 @@ import com.github.boukefalos.lirc.LircButton; import com.github.boukefalos.lirc.util.SignalObject; public class Remote extends AbstractReceiver implements Lirc { - protected ArrayList> listenList; + protected ArrayList> listenList; - public Remote(Forwarder forwarder) { - super(forwarder); - listenList = new ArrayList>(); - } + public Remote(Forwarder forwarder) { + super(forwarder); + listenList = new ArrayList>(); + } - public void register(Listen listen) { - listenList.add(listen); - } + public void register(Listen listen) { + listenList.add(listen); + } - public void remove(Listen listen) { - listenList.remove(listen); - } + public void remove(Listen listen) { + listenList.remove(listen); + } - public void receive(byte[] buffer) { - Object object = decode(buffer); - if (object != null) { - for (Listen listen : listenList) { - listen.add(object); - } - } - } + public void receive(byte[] buffer) { + Object object = decode(buffer); + if (object != null) { + for (Listen listen : listenList) { + listen.add(object); + } + } + } - public SignalObject decode(byte[] buffer) { - ByteArrayInputStream input = new ByteArrayInputStream(buffer); - try { - Button button = Button.parseDelimitedFrom(input); - Type type = button.getType(); - Signal signal = button.getSignal(); - switch (type) { - case COLOR: - Color color = button.getColorButton().getColor(); - return new SignalObject(signal, color); - case DIRECTION: - Direction direction = button.getDirectionButton().getDirection(); - return new SignalObject(signal, direction); - case NUMBER: - Number number = button.getNumberButton().getNumber(); - return new SignalObject(signal, number); - case LIRC: - String remote = button.getLircButton().getRemote(); - String code = button.getLircButton().getCode(); - LircButton lircButton = new LircButton(remote, code); - return new SignalObject(signal, lircButton); - } - } catch (IOException e) { - logger.error("Failed to parse input"); - } - return null; - } + public SignalObject decode(byte[] buffer) { + ByteArrayInputStream input = new ByteArrayInputStream(buffer); + try { + Button button = Button.parseDelimitedFrom(input); + Type type = button.getType(); + Signal signal = button.getSignal(); + switch (type) { + case COLOR: + Color color = button.getColorButton().getColor(); + return new SignalObject(signal, color); + case DIRECTION: + Direction direction = button.getDirectionButton().getDirection(); + return new SignalObject(signal, direction); + case NUMBER: + Number number = button.getNumberButton().getNumber(); + return new SignalObject(signal, number); + case LIRC: + String remote = button.getLircButton().getRemote(); + String code = button.getLircButton().getCode(); + LircButton lircButton = new LircButton(remote, code); + return new SignalObject(signal, lircButton); + } + } catch (IOException e) { + logger.error("Failed to parse input"); + } + return null; + } } \ No newline at end of file diff --git a/src/main/java/com/github/boukefalos/lirc/util/Multiplexer.java b/src/main/java/com/github/boukefalos/lirc/util/Multiplexer.java index 3353378..91a5db3 100644 --- a/src/main/java/com/github/boukefalos/lirc/util/Multiplexer.java +++ b/src/main/java/com/github/boukefalos/lirc/util/Multiplexer.java @@ -30,7 +30,7 @@ public class Multiplexer { protected int timeout; protected ArrayList> listenList; - protected ScheduledExecutorService executor; + protected ScheduledExecutorService executor; protected HashMap counterMap; public Multiplexer() { @@ -38,63 +38,63 @@ public class Multiplexer { } public Multiplexer(int timeout) { - this.timeout = timeout; - listenList = new ArrayList>(); + this.timeout = timeout; + listenList = new ArrayList>(); executor = Executors.newSingleThreadScheduledExecutor(); counterMap = new HashMap(); } public void register(Listen listen) { - listenList.add(listen); + listenList.add(listen); } public void remove(Listen> listen) { - listenList.remove(listen); + listenList.remove(listen); } - public synchronized void add(T object) { - Expire expire = new Expire(this, object); - executor.schedule(expire, (long) timeout, TimeUnit.MILLISECONDS); - int counter = counterMap.getOrDefault(object, 0); - if (counter == 0) { - for (Listen listen : listenList) { - listen.add(new SignalObject(Signal.BEGIN, object)); - } - } - counterMap.put(object, counter + 1); + public synchronized void add(T object) { + Expire expire = new Expire(this, object); + executor.schedule(expire, (long) timeout, TimeUnit.MILLISECONDS); + int counter = counterMap.getOrDefault(object, 0); + if (counter == 0) { + for (Listen listen : listenList) { + listen.add(new SignalObject(Signal.BEGIN, object)); + } + } + counterMap.put(object, counter + 1); } - protected synchronized void expire(T object) { - int counter = counterMap.get(object); - counterMap.put(object, counter - 1); - if (counter == 1) { - for (Listen listen : listenList) { - listen.add(new SignalObject(Signal.END, object)); - } - } - } + protected synchronized void expire(T object) { + int counter = counterMap.get(object); + counterMap.put(object, counter - 1); + if (counter == 1) { + for (Listen listen : listenList) { + listen.add(new SignalObject(Signal.END, object)); + } + } + } - public class Expire implements Runnable { - protected Multiplexer multiplexer; - protected T object; + public class Expire implements Runnable { + protected Multiplexer multiplexer; + protected T object; - public Expire(Multiplexer multiplexer, T object) { - this.multiplexer = multiplexer; - this.object = object; - } + public Expire(Multiplexer multiplexer, T object) { + this.multiplexer = multiplexer; + this.object = object; + } - public void run() { - multiplexer.expire(object); - } - } + public void run() { + multiplexer.expire(object); + } + } - public void stop() { - executor.shutdown(); - - } - - public void exit() { - stop(); - // Should cancel all scheduled Runnables - } + public void stop() { + executor.shutdown(); + + } + + public void exit() { + stop(); + // Should cancel all scheduled Runnables + } } diff --git a/src/main/java/com/github/boukefalos/lirc/util/SignalObject.java b/src/main/java/com/github/boukefalos/lirc/util/SignalObject.java index 4c16543..1f7118e 100644 --- a/src/main/java/com/github/boukefalos/lirc/util/SignalObject.java +++ b/src/main/java/com/github/boukefalos/lirc/util/SignalObject.java @@ -3,16 +3,16 @@ package com.github.boukefalos.lirc.util; import lirc.Lirc.Signal; public class SignalObject { - public Signal signal; - public T object; + public Signal signal; + public T object; - public SignalObject(Signal signal, T object) { - this.signal = signal; - this.object = object; - } + public SignalObject(Signal signal, T object) { + this.signal = signal; + this.object = object; + } - public String bla() { - return signal + " " + object; - } + public String bla() { + return signal + " " + object; + } } diff --git a/src/test/java/test/TestLocal.java b/src/test/java/test/TestLocal.java index b27165b..abedf4b 100644 --- a/src/test/java/test/TestLocal.java +++ b/src/test/java/test/TestLocal.java @@ -9,37 +9,37 @@ import com.github.boukefalos.lirc.LircButton; import com.github.boukefalos.lirc.implementation.Local; import com.github.boukefalos.lirc.util.SignalObject; -public class TestLocal extends Listen { - public static void main(String[] args) { - new TestLocal().start(); - try { - Thread.sleep(1000000); - } catch (InterruptedException e) {} - } +public class TestLocal extends Listen { + public static void main(String[] args) { + new TestLocal().start(); + try { + Thread.sleep(1000000); + } catch (InterruptedException e) {} + } - protected Lirc lirc; + protected Lirc lirc; - public TestLocal() { - lirc = new Local(); - lirc.register(this); - } + public TestLocal() { + lirc = new Local(); + lirc.register(this); + } public void activate() throws ActivateException { - lirc.start(); + lirc.start(); super.activate(); } - public void start() { - super.start(); - } + public void start() { + super.start(); + } - public void input(SignalObject lircButtonSignal) { - Object object = lircButtonSignal.object; - if (object instanceof LircButton) { - Signal signal = lircButtonSignal.signal; - LircButton lircButton = lircButtonSignal.object; - String code = lircButton.code; - logger.error(signal.name() + " : " + code + " @ " + lircButton.remote); - } - } + public void input(SignalObject lircButtonSignal) { + Object object = lircButtonSignal.object; + if (object instanceof LircButton) { + Signal signal = lircButtonSignal.signal; + LircButton lircButton = lircButtonSignal.object; + String code = lircButton.code; + logger.error(signal.name() + " : " + code + " @ " + lircButton.remote); + } + } } diff --git a/src/test/java/test/TestRemoteImplementation.java b/src/test/java/test/TestRemoteImplementation.java index f5b1727..c384967 100644 --- a/src/test/java/test/TestRemoteImplementation.java +++ b/src/test/java/test/TestRemoteImplementation.java @@ -14,39 +14,39 @@ import com.github.boukefalos.lirc.Server; import com.github.boukefalos.lirc.util.SignalObject; public class TestRemoteImplementation extends Listen { - protected Lirc lirc; + protected Lirc lirc; - public TestRemoteImplementation(Loader loader) { - lirc = loader.getLirc(); - lirc.register(this); - } + public TestRemoteImplementation(Loader loader) { + lirc = loader.getLirc(); + lirc.register(this); + } public void activate() throws ActivateException { - lirc.start(); + lirc.start(); super.activate(); } - public void input(SignalObject lircButtonSignal) { - Object object = lircButtonSignal.object; - if (object instanceof LircButton) { - Signal signal = lircButtonSignal.signal; - LircButton lircButton = lircButtonSignal.object; - String code = lircButton.code; - logger.error(signal.name() + " : " + code + " @ " + lircButton.remote); - } - } - - public static void main(Properties localProperties, Properties remoteProperties) throws LoaderException { - Loader localLoader = new Loader(localProperties); - Loader remoteLoader = new Loader(remoteProperties); + public void input(SignalObject lircButtonSignal) { + Object object = lircButtonSignal.object; + if (object instanceof LircButton) { + Signal signal = lircButtonSignal.signal; + LircButton lircButton = lircButtonSignal.object; + String code = lircButton.code; + logger.error(signal.name() + " : " + code + " @ " + lircButton.remote); + } + } + + public static void main(Properties localProperties, Properties remoteProperties) throws LoaderException { + Loader localLoader = new Loader(localProperties); + Loader remoteLoader = new Loader(remoteProperties); - Server server = localLoader.getServer(); + Server server = localLoader.getServer(); - server.start(); - new TestRemoteImplementation(remoteLoader).start(); + server.start(); + new TestRemoteImplementation(remoteLoader).start(); - try { - Thread.sleep(1000000); - } catch (InterruptedException e) {} - } + try { + Thread.sleep(1000000); + } catch (InterruptedException e) {} + } } diff --git a/src/test/java/test/TestTcpImplementation.java b/src/test/java/test/TestTcpImplementation.java index 91345ad..eeb3a82 100644 --- a/src/test/java/test/TestTcpImplementation.java +++ b/src/test/java/test/TestTcpImplementation.java @@ -5,19 +5,19 @@ import java.util.Properties; import base.exception.LoaderException; public class TestTcpImplementation { - public static void main(String[] args) throws LoaderException { - Properties localProperties = new Properties(); - localProperties.setProperty("implementation", "local"); - localProperties.setProperty("server", "true"); - localProperties.setProperty("server.port", "8883"); - localProperties.setProperty("server.protocol", "tcp"); + public static void main(String[] args) throws LoaderException { + Properties localProperties = new Properties(); + localProperties.setProperty("implementation", "local"); + localProperties.setProperty("server", "true"); + localProperties.setProperty("server.port", "8883"); + localProperties.setProperty("server.protocol", "tcp"); - Properties remoteProperties = new Properties(); - remoteProperties.setProperty("implementation", "remote"); - remoteProperties.setProperty("protocol", "tcp"); - remoteProperties.setProperty("remote.host", "localhost"); - remoteProperties.setProperty("remote.port", "8883"); + Properties remoteProperties = new Properties(); + remoteProperties.setProperty("implementation", "remote"); + remoteProperties.setProperty("protocol", "tcp"); + remoteProperties.setProperty("remote.host", "localhost"); + remoteProperties.setProperty("remote.port", "8883"); - TestRemoteImplementation.main(localProperties, remoteProperties); - } + TestRemoteImplementation.main(localProperties, remoteProperties); + } } diff --git a/src/test/java/test/TestUdpImplementation.java b/src/test/java/test/TestUdpImplementation.java index 7dee2e5..12ad6cc 100644 --- a/src/test/java/test/TestUdpImplementation.java +++ b/src/test/java/test/TestUdpImplementation.java @@ -5,19 +5,19 @@ import java.util.Properties; import base.exception.LoaderException; public class TestUdpImplementation { - public static void main(String[] args) throws LoaderException { - Properties localProperties = new Properties(); - localProperties.setProperty("implementation", "local"); - localProperties.setProperty("server", "true"); - localProperties.setProperty("server.port", "8883"); - localProperties.setProperty("server.protocol", "udp"); + public static void main(String[] args) throws LoaderException { + Properties localProperties = new Properties(); + localProperties.setProperty("implementation", "local"); + localProperties.setProperty("server", "true"); + localProperties.setProperty("server.port", "8883"); + localProperties.setProperty("server.protocol", "udp"); - Properties remoteProperties = new Properties(); - remoteProperties.setProperty("implementation", "remote"); - remoteProperties.setProperty("protocol", "udp"); - remoteProperties.setProperty("remote.host", "localhost"); - remoteProperties.setProperty("remote.port", "8883"); + Properties remoteProperties = new Properties(); + remoteProperties.setProperty("implementation", "remote"); + remoteProperties.setProperty("protocol", "udp"); + remoteProperties.setProperty("remote.host", "localhost"); + remoteProperties.setProperty("remote.port", "8883"); - TestRemoteImplementation.main(localProperties, remoteProperties); - } + TestRemoteImplementation.main(localProperties, remoteProperties); + } }