cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] cxf git commit: Close a socket
Date Thu, 07 Apr 2016 10:51:22 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 7cccdcf53 -> 53d7ad07c


Close a socket


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/53d7ad07
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/53d7ad07
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/53d7ad07

Branch: refs/heads/master
Commit: 53d7ad07c1f067457d987e6b89d54a00a427bf55
Parents: 5fc95af
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Apr 7 11:50:54 2016 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Apr 7 11:51:09 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/JAXRSClientServerSpringBookTest.java  | 35 ++++++++++----------
 1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/53d7ad07/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
index f15c640..5994269 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
@@ -785,24 +785,25 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
     @Test
     public void testRetrieveBookAegis3() throws Exception {
         
-        Socket s = new Socket("localhost", Integer.parseInt(PORT));
-        
-        InputStream is = this.getClass().getResourceAsStream("resources/retrieveRequest.txt");
-        byte[] bytes = IOUtils.readBytesFromStream(is);
-        s.getOutputStream().write(bytes);
-        s.getOutputStream().flush();
-        
-        BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream()));
-        StringBuilder sb = new StringBuilder();
-        String str = null;
-        while ((str = r.readLine()) != null) {
-            sb.append(str);
-        }
+        try (Socket s = new Socket("localhost", Integer.parseInt(PORT));
+            InputStream is = this.getClass().getResourceAsStream("resources/retrieveRequest.txt"))
{
+        
+            byte[] bytes = IOUtils.readBytesFromStream(is);
+            s.getOutputStream().write(bytes);
+            s.getOutputStream().flush();
+        
+            BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream()));
+            StringBuilder sb = new StringBuilder();
+            String str = null;
+            while ((str = r.readLine()) != null) {
+                sb.append(str);
+            }
         
-        String aegisData = sb.toString();
-        s.getInputStream().close();
-        s.close();
-        assertTrue(aegisData.contains("CXF in Action - 2"));
+            String aegisData = sb.toString();
+            s.getInputStream().close();
+            s.close();
+            assertTrue(aegisData.contains("CXF in Action - 2"));
+        }
         
     }
     


Mime
View raw message