From 863fb08fa11372e5d97126d76d073b445e74e04f Mon Sep 17 00:00:00 2001
From: dream <dream@mail.i2p>
Date: Sat, 1 Oct 2011 17:21:53 +0000
Subject: [PATCH] Added rudimentary channel support.

---
 .../java/src/net/i2p/client/streaming/I2PSocket.java         | 3 +++
 .../java/src/net/i2p/client/streaming/I2PSocketFull.java     | 5 +++++
 .../java/src/net/i2p/client/streaming/StandardSocket.java    | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java
index 595385cc47..4c135ee662 100644
--- a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java
+++ b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java
@@ -3,6 +3,7 @@ package net.i2p.client.streaming;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.channels.SelectableChannel;
 
 import net.i2p.data.Destination;
 
@@ -34,6 +35,8 @@ public interface I2PSocket {
      */
     public OutputStream getOutputStream() throws IOException;
 
+    public SelectableChannel getChannel() throws IOException;
+
     /** 
      * @return socket's configuration
      */
diff --git a/apps/streaming/java/src/net/i2p/client/streaming/I2PSocketFull.java b/apps/streaming/java/src/net/i2p/client/streaming/I2PSocketFull.java
index 5cd76a864f..59e31b662b 100644
--- a/apps/streaming/java/src/net/i2p/client/streaming/I2PSocketFull.java
+++ b/apps/streaming/java/src/net/i2p/client/streaming/I2PSocketFull.java
@@ -3,6 +3,7 @@ package net.i2p.client.streaming;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.channels.SelectableChannel;
 
 import net.i2p.client.I2PSession;
 import net.i2p.data.Destination;
@@ -66,6 +67,10 @@ class I2PSocketFull implements I2PSocket {
         else
             return null;
     }
+
+    public SelectableChannel getChannel() {
+        return new MessageChannel(this);
+    }
     
     /**
      *  Warning, may return null instead of throwing IOE,
diff --git a/apps/streaming/java/src/net/i2p/client/streaming/StandardSocket.java b/apps/streaming/java/src/net/i2p/client/streaming/StandardSocket.java
index b0ffbf2504..22b04881c1 100644
--- a/apps/streaming/java/src/net/i2p/client/streaming/StandardSocket.java
+++ b/apps/streaming/java/src/net/i2p/client/streaming/StandardSocket.java
@@ -71,7 +71,7 @@ class StandardSocket extends Socket {
      */
     @Override
     public SocketChannel getChannel() {
-        return null;
+        return _socket.getChannel();
     }
 
     /**
-- 
GitLab