-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from eatkins/max-socket-length
Add maxSocketLength to native api
- Loading branch information
Showing
9 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
jni/org_scalasbt_ipcsocket_JNIUnixDomainSocketLibraryProvider.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
26 changes: 26 additions & 0 deletions
26
src/test/java/org/scalasbt/ipcsocket/UnixSocketLengthTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.scalasbt.ipcsocket; | ||
|
||
import org.junit.Test; | ||
import static org.junit.Assert.*; | ||
|
||
public class UnixSocketLengthTest { | ||
final boolean isWin = System.getProperty("os.name", "").toLowerCase().startsWith("win"); | ||
final boolean isLinux = System.getProperty("os.name", "").toLowerCase().startsWith("linux"); | ||
|
||
@Test | ||
public void testJNIMaxSocketLength() { | ||
if (!isWin) { | ||
int length = UnixDomainSocketLibraryProvider.maxSocketLength(true); | ||
int expectedLength = isLinux ? 108 : 104; | ||
assert (length == expectedLength); | ||
} | ||
} | ||
|
||
@Test | ||
public void testJNAMaxSocketLength() { | ||
if (!isWin) { | ||
int length = UnixDomainSocketLibraryProvider.maxSocketLength(false); | ||
assert (length == 104); | ||
} | ||
} | ||
} |