inital plugin from webtools project
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.monitor.core / src / net / sourceforge / phpdt / monitor / core / internal / Connection.java
diff --git a/archive/net.sourceforge.phpeclipse.monitor.core/src/net/sourceforge/phpdt/monitor/core/internal/Connection.java b/archive/net.sourceforge.phpeclipse.monitor.core/src/net/sourceforge/phpdt/monitor/core/internal/Connection.java
new file mode 100644 (file)
index 0000000..ef7eadc
--- /dev/null
@@ -0,0 +1,31 @@
+package net.sourceforge.phpdt.monitor.core.internal;
+
+import java.net.Socket;
+/**
+ * 
+ */
+public class Connection {
+       protected Socket in;
+       protected Socket out;
+       
+       public Connection(Socket in, Socket out) {
+               this.in = in;
+               this.out = out;
+       }
+
+       public void close() {
+               Trace.trace(Trace.FINEST, "Closing connection");
+               try {
+                       in.getOutputStream().flush();
+                       in.shutdownInput();
+                       in.shutdownOutput();
+                       
+                       out.getOutputStream().flush();
+                       out.shutdownInput();
+                       out.shutdownOutput();
+                       Trace.trace(Trace.FINEST, "Connection closed");
+               } catch (Exception ex) {
+                       Trace.trace(Trace.WARNING, "Error closing connection " + this + " " + ex.getMessage());
+               }
+       }
+}
\ No newline at end of file