|
8 | 8 | import org.junit.runners.MethodSorters; |
9 | 9 |
|
10 | 10 | import java.io.*; |
| 11 | +import java.nio.charset.StandardCharsets; |
11 | 12 | import java.util.Set; |
12 | 13 |
|
13 | 14 | import static org.junit.Assert.assertEquals; |
|
17 | 18 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) |
18 | 19 | public class HubIPCJavaSideIntegrationTest { |
19 | 20 |
|
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"; |
22 | 23 | private final int ipcPortA = 6000; |
23 | 24 | private final int messagePortA = 6100; |
24 | 25 | private final int ipcPortB = 6200; |
@@ -117,7 +118,7 @@ public void stage02RegisterPeersAndSendMessage() throws IOException, Interrupted |
117 | 118 | hubIPCJavaSideA.disconnect(this.peerIdA, this.peerIdB); |
118 | 119 | int attempt = 0; |
119 | 120 | boolean disconnected = false; |
120 | | - while(attempt < 3){ |
| 121 | + while(attempt < 6){ |
121 | 122 | if(hubIPCJavaSideB.hasActiveConnection()){ |
122 | 123 | attempt++; |
123 | 124 | Thread.sleep(1000); |
@@ -165,18 +166,18 @@ private boolean checkPeerIsNotRegistered(HubIPCJavaSide hubIPCJavaSide, CharSequ |
165 | 166 | */ |
166 | 167 | private class StringInputStream extends InputStream { |
167 | 168 |
|
168 | | - private String stringToRead; |
169 | 169 | private int readPosition = 0; |
| 170 | + private byte[] bytesToRead; |
170 | 171 |
|
171 | 172 | public StringInputStream(String stringToRead){ |
172 | | - this.stringToRead = stringToRead; |
| 173 | + this.bytesToRead = stringToRead.getBytes(StandardCharsets.UTF_8); |
173 | 174 | } |
174 | 175 |
|
175 | 176 | @Override |
176 | 177 | public int read() throws IOException { |
177 | | - if(this.readPosition < this.stringToRead.length()){ |
| 178 | + if(this.readPosition < this.bytesToRead.length){ |
178 | 179 | this.readPosition ++; |
179 | | - return stringToRead.charAt(this.readPosition-1); |
| 180 | + return bytesToRead[this.readPosition-1]; |
180 | 181 | } |
181 | 182 | try { |
182 | 183 | Thread.sleep(100000); |
|
0 commit comments