hard requirement for console version match #4187

This commit is contained in:
rusefillc 2022-06-01 13:38:12 -04:00
parent 45d614f73c
commit 3c1188f6ec
1 changed files with 8 additions and 1 deletions

View File

@ -15,17 +15,21 @@ import com.rusefi.proxy.NetworkConnector;
import com.rusefi.server.ControllerInfo;
import com.rusefi.server.SessionDetails;
import com.rusefi.server.rusEFISSLContext;
import com.rusefi.shared.FileUtil;
import com.rusefi.tune.xml.Constant;
import org.jetbrains.annotations.NotNull;
import org.mockito.stubbing.Answer;
import java.io.IOException;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.Timeouts.READ_IMAGE_TIMEOUT;
import static com.rusefi.config.generated.Fields.TS_FILE_VERSION;
import static com.rusefi.config.generated.Fields.TS_FILE_VERSION_OFFSET;
import static com.rusefi.io.tcp.TcpConnector.LOCALHOST;
import static org.junit.Assert.assertTrue;
@ -57,7 +61,10 @@ public class TestHelper {
public static BinaryProtocolServer createVirtualController(ConfigurationImage ci, int port, Listener serverSocketCreationCallback, BinaryProtocolServer.Context context) throws IOException {
BinaryProtocolState state = new BinaryProtocolState();
state.setController(ci);
state.setCurrentOutputs(new byte[1 + Fields.TS_TOTAL_OUTPUT_SIZE]);
byte[] currentOutputs = new byte[Fields.TS_TOTAL_OUTPUT_SIZE];
ByteBuffer buffer = FileUtil.littleEndianWrap(currentOutputs, TS_FILE_VERSION_OFFSET, 4);
buffer.putInt(TS_FILE_VERSION);
state.setCurrentOutputs(currentOutputs);
LinkManager linkManager = new LinkManager();
linkManager.setConnector(LinkConnector.getDetachedConnector(state));