Skip to content

Commit

Permalink
flush?
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Sep 4, 2024
1 parent 1f7e41a commit 01786d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/test/java/org/scalasbt/ipcsocket/SocketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class SocketTest extends BaseSocketSetup {
public void testAssertEquals() throws IOException, InterruptedException {
withSocket(
sock -> {
System.out.println("SocketTest#testAssertEquals");

ServerSocket serverSocket = newServerSocket(sock);

CompletableFuture<Boolean> server =
Expand Down Expand Up @@ -54,6 +56,8 @@ public void testAssertEquals() throws IOException, InterruptedException {
public void throwIOExceptionOnMissingFile() throws IOException, InterruptedException {
withSocket(
sock -> {
System.out.println("SocketTest#throwIOExceptionOnMissingFile");

boolean caughtIOException = false;
Files.deleteIfExists(Paths.get(sock));
try {
Expand All @@ -70,6 +74,8 @@ public void throwIOExceptionOnMissingFile() throws IOException, InterruptedExcep
public void shortReadWrite() throws IOException, InterruptedException {
withSocket(
sock -> {
System.out.println("SocketTest#shortReadWrite");

ServerSocket serverSocket = newServerSocket(sock);

CompletableFuture<Boolean> server =
Expand All @@ -91,6 +97,7 @@ public void shortReadWrite() throws IOException, InterruptedException {
byte[] printedBytes = printed.getBytes();
out.write(printedBytes, 0, 4);
out.write(printedBytes, 4, 5);
out.flush();
byte[] buf = new byte[16];
assertEquals("Did not read 4 bytes", in.read(buf, 0, 4), 4);
assertEquals("Did not read 5 bytes", in.read(buf, 4, 6), 5);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/scalasbt/ipcsocket/duplex/Sender.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void run() {
for (int i = 0; i < sendMessages; i++) {
System.out.println("[" + name + "] sending msg: " + i);
out.println("hello" + i);
out.flush();
Thread.sleep(Math.abs(random.nextInt(1000)));
}
} catch (IOException | InterruptedException e) {
Expand Down

0 comments on commit 01786d0

Please sign in to comment.