diff options
author | Vitaly Takmazov | 2016-01-30 16:13:30 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-01-30 16:13:30 +0300 |
commit | 474323453f1b881273f618555845e07ace830bd2 (patch) | |
tree | 11673a80973b3fb493912edc366ade720ecf40c4 /src/main/java/com/juick/xmpp/s2s/ConnectionIn.java | |
parent | 58fb4a6394cb19ee04e65d0e921cdf0ae6fdb6e3 (diff) |
s2s: NIO.2 sockets
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionIn.java')
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/ConnectionIn.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java index fad97c16..7b9483f7 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java @@ -5,18 +5,19 @@ import com.juick.xmpp.JID; import com.juick.xmpp.Message; import com.juick.xmpp.Presence; import com.juick.xmpp.utils.XmlUtils; +import org.xmlpull.v1.XmlPullParser; import java.io.EOFException; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.net.Socket; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.Channels; import java.util.ArrayList; +import java.util.List; import java.util.UUID; import java.util.logging.Logger; -import org.xmlpull.v1.XmlPullParser; - /** * * @author ugnich @@ -25,11 +26,11 @@ public class ConnectionIn extends Connection implements Runnable { private static final Logger LOGGER = Logger.getLogger(ConnectionIn.class.getName()); - final public ArrayList<String> from = new ArrayList<String>(); + final public List<String> from = new ArrayList<>(); public long tsRemoteData = 0; public long packetsRemote = 0; - public ConnectionIn(Socket socket) { + public ConnectionIn(AsynchronousSocketChannel socket) { super(); this.socket = socket; streamID = UUID.randomUUID().toString(); @@ -39,8 +40,8 @@ public class ConnectionIn extends Connection implements Runnable { public void run() { LOGGER.info("STREAM FROM ? " + streamID + " START"); try { - parser.setInput(new InputStreamReader(socket.getInputStream())); - writer = new OutputStreamWriter(socket.getOutputStream()); + parser.setInput(new InputStreamReader(Channels.newInputStream(socket))); + writer = new OutputStreamWriter(Channels.newOutputStream(socket)); parser.next(); // stream:stream updateTsRemoteData(); |