hacks to support resin-based connections
[org.ibex.io.git] / src / org / ibex / io / Connection.java
index 5c8d148..5c8c0fd 100644 (file)
@@ -13,8 +13,9 @@ public class Connection extends Stream {
     private final Socket s;
     public final String vhost;
     public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; }
     private final Socket s;
     public final String vhost;
     public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; }
+    protected Connection(InputStream i, OutputStream o) { super(i, o); vhost = null; s = null; }
     public Socket getSocket() { return s; }
     public Socket getSocket() { return s; }
-    public void close()                       { try{s.close();}catch(Exception e){throw new Stream.StreamException(e);} super.close(); }
+    public void close()                       { try{if (s!=null) s.close();}catch(Exception e){throw new Stream.StreamException(e);} super.close(); }
     public int getLocalPort()                 { return s.getLocalPort(); }
     public InetAddress getLocalAddress()      { return ((InetSocketAddress)s.getLocalSocketAddress()).getAddress(); }
     public int getRemotePort()                { return s.getPort(); }
     public int getLocalPort()                 { return s.getLocalPort(); }
     public InetAddress getLocalAddress()      { return ((InetSocketAddress)s.getLocalSocketAddress()).getAddress(); }
     public int getRemotePort()                { return s.getPort(); }