diff --git a/java_console/io/io.iml b/java_console/io/io.iml
index e1018db598..de09d6d820 100644
--- a/java_console/io/io.iml
+++ b/java_console/io/io.iml
@@ -10,10 +10,11 @@
-
+
-
+
-
+
+
\ No newline at end of file
diff --git a/java_console/shared_io/src/main/java/com/rusefi/server/ControllerInfo.java b/java_console/io/src/main/java/com/rusefi/server/ControllerInfo.java
similarity index 100%
rename from java_console/shared_io/src/main/java/com/rusefi/server/ControllerInfo.java
rename to java_console/io/src/main/java/com/rusefi/server/ControllerInfo.java
diff --git a/java_console/shared_io/src/main/java/com/rusefi/server/SessionDetails.java b/java_console/io/src/main/java/com/rusefi/server/SessionDetails.java
similarity index 100%
rename from java_console/shared_io/src/main/java/com/rusefi/server/SessionDetails.java
rename to java_console/io/src/main/java/com/rusefi/server/SessionDetails.java
diff --git a/java_console/shared_io/shared_io.iml b/java_console/shared_io/shared_io.iml
index ef07f08d4b..6711231c0c 100644
--- a/java_console/shared_io/shared_io.iml
+++ b/java_console/shared_io/shared_io.iml
@@ -13,6 +13,5 @@
-
\ No newline at end of file
diff --git a/java_console/ui/src/test/java/com/rusefi/ServerTest.java b/java_console/ui/src/test/java/com/rusefi/ServerTest.java
index 09b48eff36..c72723e581 100644
--- a/java_console/ui/src/test/java/com/rusefi/ServerTest.java
+++ b/java_console/ui/src/test/java/com/rusefi/ServerTest.java
@@ -60,7 +60,7 @@ public class ServerTest {
}
};
- backend.runControllerConnector(serverPort, serverCreated);
+ backend.runControllerConnector(serverPort, parameter -> serverCreated.countDown());
assertTrue(serverCreated.await(30, TimeUnit.SECONDS));
assertEquals(0, backend.getCount());
@@ -94,7 +94,7 @@ public class ServerTest {
};
CountDownLatch applicationServerCreated = new CountDownLatch(1);
- backend.runApplicationConnector(serverPortForRemoteUsers, applicationServerCreated);
+ backend.runApplicationConnector(serverPortForRemoteUsers, parameter -> applicationServerCreated.countDown());
assertTrue(applicationServerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
// start authenticator
@@ -123,7 +123,7 @@ public class ServerTest {
};
CountDownLatch applicationServerCreated = new CountDownLatch(1);
- backend.runApplicationConnector(serverPortForRemoteUsers, applicationServerCreated);
+ backend.runApplicationConnector(serverPortForRemoteUsers, parameter -> applicationServerCreated.countDown());
assertTrue(applicationServerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
SessionDetails sessionDetails = MockRusEfiDevice.createTestSession(MockRusEfiDevice.TEST_TOKEN_1, Fields.TS_SIGNATURE);
@@ -161,11 +161,13 @@ public class ServerTest {
// first start backend server
CountDownLatch controllerServerCreated = new CountDownLatch(1);
- backend.runControllerConnector(serverPortForControllers, controllerServerCreated);
- assertTrue(controllerServerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
-
CountDownLatch applicationServerCreated = new CountDownLatch(1);
- backend.runApplicationConnector(serverPortForRemoteUsers, applicationServerCreated);
+
+ backend.runControllerConnector(serverPortForControllers, parameter -> controllerServerCreated.countDown());
+
+ backend.runApplicationConnector(serverPortForRemoteUsers, parameter -> applicationServerCreated.countDown());
+
+ assertTrue(controllerServerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
assertTrue(applicationServerCreated.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
diff --git a/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java b/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java
index 9220c6aca9..ec1315e466 100644
--- a/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java
+++ b/java_tools/proxy_server/src/main/java/com/rusefi/server/Backend.java
@@ -1,6 +1,7 @@
package com.rusefi.server;
import com.opensr5.Logger;
+import com.rusefi.Listener;
import com.rusefi.io.IoStream;
import com.rusefi.io.commands.HelloCommand;
import com.rusefi.io.tcp.BinaryProtocolProxy;
@@ -20,7 +21,6 @@ import javax.json.JsonObject;
import java.io.IOException;
import java.net.Socket;
import java.util.*;
-import java.util.concurrent.CountDownLatch;
import java.util.function.Function;
public class Backend {
@@ -71,7 +71,7 @@ public class Backend {
}
- public void runApplicationConnector(int serverPortForApplications, CountDownLatch serverCreated) {
+ public void runApplicationConnector(int serverPortForApplications, Listener serverSocketCreationCallback) {
BinaryProtocolServer.tcpServerSocket(serverPortForApplications, "ApplicationServer", new Function() {
@Override
public Runnable apply(Socket applicationSocket) {
@@ -114,14 +114,14 @@ public class Backend {
}
};
}
- }, logger, parameter -> serverCreated.countDown());
+ }, logger, serverSocketCreationCallback);
}
protected void onDisconnectApplication() {
logger.info("Disconnecting application");
}
- public void runControllerConnector(int serverPortForControllers, CountDownLatch serverCreated) {
+ public void runControllerConnector(int serverPortForControllers, Listener serverSocketCreationCallback) {
BinaryProtocolServer.tcpServerSocket(serverPortForControllers, "ControllerServer", new Function() {
@Override
public Runnable apply(Socket controllerSocket) {
@@ -133,14 +133,15 @@ public class Backend {
controllerConnectionState.requestControllerInfo();
register(controllerConnectionState);
-// controllerConnectionState.runEndlessLoop();
+
+ controllerConnectionState.getOutputs();
} catch (IOException e) {
close(controllerConnectionState);
}
}
};
}
- }, logger, parameter -> serverCreated.countDown());
+ }, logger, serverSocketCreationCallback);
}
@NotNull
diff --git a/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java b/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java
index e02e4fb3ea..d6a24f2199 100644
--- a/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java
+++ b/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java
@@ -96,14 +96,18 @@ public class ControllerConnectionState {
public void runEndlessLoop() throws IOException {
while (true) {
- byte[] commandPacket = GetOutputsCommand.createRequest();
-
- stream.sendPacket(commandPacket, logger);
-
- byte[] packet = incomingData.getPacket(logger, "msg", true);
- if (packet == null)
- throw new IOException("No response");
+ getOutputs();
}
}
+
+ public void getOutputs() throws IOException {
+ byte[] commandPacket = GetOutputsCommand.createRequest();
+
+ stream.sendPacket(commandPacket, logger);
+
+ byte[] packet = incomingData.getPacket(logger, "msg", true);
+ if (packet == null)
+ throw new IOException("No response");
+ }
}