Skip to content

Commit 7f96873

Browse files
committed
2 parents daae43c + 6584d50 commit 7f96873

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

tests/net/sharksystem/lora_integration_test/HubIPCJavaSideIntegrationTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.junit.runners.MethodSorters;
99

1010
import java.io.*;
11+
import java.nio.charset.StandardCharsets;
1112
import java.util.Set;
1213

1314
import static org.junit.Assert.assertEquals;
@@ -17,8 +18,8 @@
1718
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1819
public class HubIPCJavaSideIntegrationTest {
1920

20-
private final String hostA = "localhost";
21-
private final String hostB = "localhost";
21+
private final String hostA = "192.168.178.201";
22+
private final String hostB = "192.168.178.200";
2223
private final int ipcPortA = 6000;
2324
private final int messagePortA = 6100;
2425
private final int ipcPortB = 6200;
@@ -117,7 +118,7 @@ public void stage02RegisterPeersAndSendMessage() throws IOException, Interrupted
117118
hubIPCJavaSideA.disconnect(this.peerIdA, this.peerIdB);
118119
int attempt = 0;
119120
boolean disconnected = false;
120-
while(attempt < 3){
121+
while(attempt < 6){
121122
if(hubIPCJavaSideB.hasActiveConnection()){
122123
attempt++;
123124
Thread.sleep(1000);
@@ -165,18 +166,18 @@ private boolean checkPeerIsNotRegistered(HubIPCJavaSide hubIPCJavaSide, CharSequ
165166
*/
166167
private class StringInputStream extends InputStream {
167168

168-
private String stringToRead;
169169
private int readPosition = 0;
170+
private byte[] bytesToRead;
170171

171172
public StringInputStream(String stringToRead){
172-
this.stringToRead = stringToRead;
173+
this.bytesToRead = stringToRead.getBytes(StandardCharsets.UTF_8);
173174
}
174175

175176
@Override
176177
public int read() throws IOException {
177-
if(this.readPosition < this.stringToRead.length()){
178+
if(this.readPosition < this.bytesToRead.length){
178179
this.readPosition ++;
179-
return stringToRead.charAt(this.readPosition-1);
180+
return bytesToRead[this.readPosition-1];
180181
}
181182
try {
182183
Thread.sleep(100000);

0 commit comments

Comments
 (0)