You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2010/10/29 11:39:25 UTC

svn commit: r1028659 - in /tuscany/sca-java-1.x/trunk: distribution/src/main/release/src/ modules/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ samples/helloworld-erlang-reference/ samples/helloworld-erlang-referen...

Author: nash
Date: Fri Oct 29 09:39:25 2010
New Revision: 1028659

URL: http://svn.apache.org/viewvc?rev=1028659&view=rev
Log:
Merge r1028655 TUSCANY-3759: Add code to read stdin and stderr from spawned epmd process and reverse changes made by commit r1028378

Modified:
    tuscany/sca-java-1.x/trunk/distribution/src/main/release/src/BUILDING
    tuscany/sca-java-1.x/trunk/modules/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java
    tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/README
    tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/src/test/java/helloworld/HelloWorldErlangClientTestCase.java
    tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/README
    tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java
    tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java

Modified: tuscany/sca-java-1.x/trunk/distribution/src/main/release/src/BUILDING
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/distribution/src/main/release/src/BUILDING?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/distribution/src/main/release/src/BUILDING (original)
+++ tuscany/sca-java-1.x/trunk/distribution/src/main/release/src/BUILDING Fri Oct 29 09:39:25 2010
@@ -26,14 +26,6 @@ Initial Setup
    Unix users:
      export MAVEN_OPTS=-Xmx256m -XX:MaxPermSize=256m
 
-5) You don't need any other software installed to run the Apache Tuscany SCA
-   build. However, if you have Erlang/OTP installed and in your path, you could
-   experience build problems if the version of Erlang/OTP in your path isn't
-   compatible with the Apache Tuscany SCA Erlang binding.  To ensure that the
-   Apache Tuscany SCA build runs cleanly, you should either put the R12B version
-   of Erlang/OTP in your path or completely remove Erlang/OTP from your path
-   when running the Apache Tuscany SCA build. See TUSCANY-3759 for details.
-
 
 Building
 --------

Modified: tuscany/sca-java-1.x/trunk/modules/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/modules/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/modules/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java (original)
+++ tuscany/sca-java-1.x/trunk/modules/binding-erlang-runtime/src/test/java/org/apache/tuscany/sca/binding/erlang/testing/ReferenceServiceTestCase.java Fri Oct 29 09:39:25 2010
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.binding.e
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import java.io.InputStream;
 import java.io.IOException;
 
 import org.apache.tuscany.sca.binding.erlang.impl.TypeMismatchException;
@@ -76,9 +77,11 @@ public class ReferenceServiceTestCase {
 	private static Process epmdProcess;
 
 	@BeforeClass
-	public static void init() throws IOException {
+	public static void init() {
 		try {
 			epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
+            startReaderThread(epmdProcess.getInputStream());
+            startReaderThread(epmdProcess.getErrorStream());
 			SCADomain domain = SCADomain
 					.newInstance("ErlangReference.composite");
 			SCADomain.newInstance("ErlangService.composite");
@@ -103,6 +106,22 @@ public class ReferenceServiceTestCase {
 		}
 	}
 
+    private static void startReaderThread(final InputStream stream) {
+        Thread readerThread = new Thread() {
+            public void run() {
+                try {
+                    byte[] buf = new byte[100];
+                    while (true) {
+                        stream.read(buf);
+                    }
+                } catch (Exception e) {
+                    return;
+                }
+            }
+        };
+        readerThread.start();
+    }
+
 	@AfterClass
 	public static void clean() {
 		if (epmdProcess != null) {
@@ -737,6 +756,8 @@ public class ReferenceServiceTestCase {
 		args[0] = new OtpErlangString("world");
 		args[1] = new OtpErlangString("!");
 		refMbox.send("sayHello", "RPCServerMbox", new OtpErlangTuple(args));
+        // FIXME: this seems to help avoid occasional hangs
+        Thread.sleep(100);
 		OtpErlangString result = (OtpErlangString) refMbox.receiveMsg()
 				.getMsg();
 		assertEquals("Hello world !", result.stringValue());

Modified: tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/README
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/README?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/README (original)
+++ tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/README Fri Oct 29 09:39:25 2010
@@ -8,9 +8,6 @@ first. 
 
 In order to run Erlang samples you need to have Erlang/OTP distribution installed - 
 epmd binary is required in your system path. See http://erlang.org for downloads.
-The Tuscany SCA Erlang binding is compatible with Erlang/OTP version R12B but
-doesn't work correctly with some later versions including R14B. See TUSCANY-3759
-for details.
 
 If you just want to run it to see what happens you need to run the server first 
 so open a command prompt, navigate to the helloworld-erlang-service sample directory 

Modified: tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/src/test/java/helloworld/HelloWorldErlangClientTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/src/test/java/helloworld/HelloWorldErlangClientTestCase.java?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/src/test/java/helloworld/HelloWorldErlangClientTestCase.java (original)
+++ tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-reference/src/test/java/helloworld/HelloWorldErlangClientTestCase.java Fri Oct 29 09:39:25 2010
@@ -1,66 +1,88 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-
-package helloworld;
-
-import helloworld.dynaignore.IgnorableRunner;
-import helloworld.dynaignore.IgnoreTest;
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Test case for helloworld Erlang client
- */
-@RunWith(IgnorableRunner.class)
-public class HelloWorldErlangClientTestCase {
-
-	private static final String EPMD_COMMAND = "epmd";
-
-	@Test
-	public void testClient() throws Exception {
-		Process epmdProcess = null;
-		try {
-			epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
-		} catch (Exception e) {
-			System.out
-					.println("Cannot proceed - exception while executing "
-							+ EPMD_COMMAND
-							+ ": "
-							+ e.getMessage()
-							+ ". Valid and working Erlang/OTP distribution is required.");
-			throw new IgnoreTest();
-		}
-		SCADomain scaServiceDomain = SCADomain
-				.newInstance("helloworlderlangservice.composite");
-		SCADomain scaClientDomain = SCADomain
-				.newInstance("helloworlderlangreference.composite");
-		HelloWorldService helloWorldService = scaClientDomain.getService(
-				HelloWorldService.class, "HelloWorldServiceComponent");
-		String msg = helloWorldService.getGreetings("Smith");
-		Assert.assertEquals("Hello Smith", msg);
-		scaClientDomain.close();
-		scaServiceDomain.close();
-		epmdProcess.destroy();
-
-	}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package helloworld;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import helloworld.dynaignore.IgnorableRunner;
+import helloworld.dynaignore.IgnoreTest;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test case for helloworld Erlang client
+ */
+@RunWith(IgnorableRunner.class)
+public class HelloWorldErlangClientTestCase {
+
+	private static final String EPMD_COMMAND = "epmd";
+
+	@Test
+	public void testClient() {
+		Process epmdProcess = null;
+		try {
+			epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
+		} catch (IOException e) {
+			System.out
+					.println("Cannot proceed - exception while executing "
+							+ EPMD_COMMAND
+							+ ": "
+							+ e.getMessage()
+							+ ". Valid and working Erlang/OTP distribution is required.");
+			throw new IgnoreTest();
+		}
+        startReaderThread(epmdProcess.getInputStream());
+        startReaderThread(epmdProcess.getErrorStream());
+
+		SCADomain scaServiceDomain = SCADomain
+				.newInstance("helloworlderlangservice.composite");
+		SCADomain scaClientDomain = SCADomain
+				.newInstance("helloworlderlangreference.composite");
+		HelloWorldService helloWorldService = scaClientDomain.getService(
+				HelloWorldService.class, "HelloWorldServiceComponent");
+		String msg = helloWorldService.getGreetings("Smith");
+		Assert.assertEquals("Hello Smith", msg);
+		scaClientDomain.close();
+		scaServiceDomain.close();
+
+		epmdProcess.destroy();
+	}
+
+    private static void startReaderThread(final InputStream stream) {
+        Thread readerThread = new Thread() {
+            public void run() {
+                try {
+                    byte[] buf = new byte[100];
+                    while (true) {
+                        stream.read(buf);
+                    }
+                } catch (Exception e) {
+                    return;
+                }
+            }
+        };
+        readerThread.start();
+    }
+
+}

Modified: tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/README
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/README?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/README (original)
+++ tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/README Fri Oct 29 09:39:25 2010
@@ -8,9 +8,6 @@ first. 
 
 In order to run Erlang samples you need to have Erlang/OTP distribution installed - 
 epmd binary is required in your system path. See http://erlang.org for downloads.
-The Tuscany SCA Erlang binding is compatible with Erlang/OTP version R12B but
-doesn't work correctly with some later versions including R14B. See TUSCANY-3759
-for details.
 
 If you just want to run it to see what happens open a command prompt, navigate
 to this sample directory and do:

Modified: tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java (original)
+++ tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/main/java/helloworld/HelloWorldServer.java Fri Oct 29 09:39:25 2010
@@ -1,65 +1,84 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package helloworld;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * This server program shows how to create an SCA runtime, and start it which
- * activates the helloworld Web service endpoint.
- */
-public class HelloWorldServer {
-
-	private static final String EPMD_COMMAND = "epmd";
-
-	public static void main(String[] args) {
-		try {
-			Process process = null;
-			try {
-				process = Runtime.getRuntime().exec(EPMD_COMMAND);
-			} catch (Exception e) {
-				System.out
-						.println("Cannot proceed - exception while executing "
-								+ EPMD_COMMAND
-								+ ": "
-								+ e.getMessage()
-								+ ". Valid and working Erlang/OTP distribution is required.");
-			}
-			if (process != null) {
-				System.out.println("EPMD server started");
-				SCADomain scaDomain = SCADomain
-						.newInstance("helloworlderlangservice.composite");
-				System.out
-						.println("HelloWorld server started (press enter to shutdown)");
-				System.in.read();
-				process.destroy();
-				scaDomain.close();
-				System.out.println("EPMD server stopped");
-				System.out.println("HelloWorld server stopped");
-			}
-		} catch (IOException e) {
-			e.printStackTrace();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package helloworld;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+	private static final String EPMD_COMMAND = "epmd";
+
+	public static void main(String[] args) {
+		try {
+			Process process = null;
+			try {
+				process = Runtime.getRuntime().exec(EPMD_COMMAND);
+			} catch (IOException e) {
+				System.out
+						.println("Cannot proceed - exception while executing "
+								+ EPMD_COMMAND
+								+ ": "
+								+ e.getMessage()
+								+ ". Valid and working Erlang/OTP distribution is required.");
+			}
+			if (process != null) {
+                startReaderThread(process.getInputStream());
+                startReaderThread(process.getErrorStream());
+				System.out.println("EPMD server started");
+
+				SCADomain scaDomain = SCADomain
+						.newInstance("helloworlderlangservice.composite");
+				System.out
+						.println("HelloWorld server started (press enter to shutdown)");
+				System.in.read();
+				scaDomain.close();
+                System.out.println("HelloWorld server stopped");
+
+                process.destroy();
+				System.out.println("EPMD server stopped");
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+    private static void startReaderThread(final InputStream stream) {
+        Thread readerThread = new Thread() {
+            public void run() {
+                try {
+                    byte[] buf = new byte[100];
+                    while (true) {
+                        stream.read(buf);
+                    }
+                } catch (Exception e) {
+                    return;
+                }
+            }
+        };
+        readerThread.start();
+    }
+
+}

Modified: tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java?rev=1028659&r1=1028658&r2=1028659&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java (original)
+++ tuscany/sca-java-1.x/trunk/samples/helloworld-erlang-service/src/test/java/helloworld/HelloWorldErlangServerTestCase.java Fri Oct 29 09:39:25 2010
@@ -1,68 +1,87 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package helloworld;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-
-import helloworld.dynaignore.IgnorableRunner;
-import helloworld.dynaignore.IgnoreTest;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-
-/**
- * Tests that the helloworld server is available
- */
-@RunWith(IgnorableRunner.class)
-public class HelloWorldErlangServerTestCase {
-
-	private static final String EPMD_COMMAND = "epmd";
-
-	@Test
-	public void testServiceCall() throws IOException {
-		Process epmdProcess = null;
-		try {
-			epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
-		} catch (Exception e) {
-			System.out
-					.println("Cannot proceed - exception while executing "
-							+ EPMD_COMMAND
-							+ ": "
-							+ e.getMessage()
-							+ ". Valid and working Erlang/OTP distribution is required.");
-			throw new IgnoreTest();
-		}
-		SCADomain scaDomain = SCADomain
-				.newInstance("helloworlderlangservice.composite");
-		HelloWorldService helloWorldService = scaDomain.getService(
-				HelloWorldService.class,
-				"HelloWorldServiceComponent/HelloWorldService");
-		assertNotNull(helloWorldService);
-		assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
-		scaDomain.close();
-		epmdProcess.destroy();
-	}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import helloworld.dynaignore.IgnorableRunner;
+import helloworld.dynaignore.IgnoreTest;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests that the helloworld server is available
+ */
+@RunWith(IgnorableRunner.class)
+public class HelloWorldErlangServerTestCase {
+
+	private static final String EPMD_COMMAND = "epmd";
+
+	@Test
+	public void testServiceCall() {
+		Process epmdProcess = null;
+		try {
+			epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
+		} catch (IOException e) {
+			System.out
+					.println("Cannot proceed - exception while executing "
+							+ EPMD_COMMAND
+							+ ": "
+							+ e.getMessage()
+							+ ". Valid and working Erlang/OTP distribution is required.");
+			throw new IgnoreTest();
+		}
+        startReaderThread(epmdProcess.getInputStream());
+        startReaderThread(epmdProcess.getErrorStream());
+
+		SCADomain scaDomain = SCADomain
+				.newInstance("helloworlderlangservice.composite");
+		HelloWorldService helloWorldService = scaDomain.getService(
+				HelloWorldService.class,
+				"HelloWorldServiceComponent/HelloWorldService");
+		assertNotNull(helloWorldService);
+		assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+		scaDomain.close();
+
+		epmdProcess.destroy();
+	}
+
+    private static void startReaderThread(final InputStream stream) {
+        Thread readerThread = new Thread() {
+            public void run() {
+                try {
+                    byte[] buf = new byte[100];
+                    while (true) {
+                        stream.read(buf);
+                    }
+                } catch (Exception e) {
+                    return;
+                }
+            }
+        };
+        readerThread.start();
+    }
+
+}