diff --git a/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocket.java b/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocket.java index ed7a1d4..1273224 100644 --- a/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocket.java +++ b/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocket.java @@ -79,6 +79,10 @@ public UnixDomainSocket(int fd) { this(fd, false); } + public String toString() { + return "UnixDomainSocket(path = " + this.path + ")"; + } + public InputStream getInputStream() { return is; } diff --git a/src/test/java/org/scalasbt/ipcsocket/SocketTest.java b/src/test/java/org/scalasbt/ipcsocket/SocketTest.java index fdecadc..86341fa 100644 --- a/src/test/java/org/scalasbt/ipcsocket/SocketTest.java +++ b/src/test/java/org/scalasbt/ipcsocket/SocketTest.java @@ -113,4 +113,20 @@ public void shortReadWrite() throws IOException, InterruptedException { }); } */ + + @Test + public void testToString() throws IOException, InterruptedException { + withSocket( + sock -> { + System.out.println("SocketTest#testToString(" + Boolean.toString(useJNI()) + ")"); + ServerSocket serverSocket = newServerSocket(sock); + Socket client = newClientSocket(sock); + try { + assertTrue(client.toString().startsWith("UnixDomainSocket(path =")); + } finally { + client.close(); + serverSocket.close(); + } + }); + } }