@Override public void onRecv(byte[] b, int off, int len) { if (peer != null) { peer.handler.send(b, off, len); } }
/** Wraps sent data, from the application side to the network side */ @Override public void send(byte[] b, int off, int len) { handler.send(b, off, len); }
/** Sends a sequence of bytes in the application end. */ public void send(byte[] b, int off, int len); /**
@Override public void onRecv(byte[] b, int off, int len) { for (ConnectionHandler handler_ : handlers.toArray(EMPTY_HANDLERS)) { // "connection.onDisconnect()" might change "handlers" if (!noEcho || handler_ != handler) { handler_.send(b, off, len); } } }
@Override public void onRecv(byte[] b, int off, int len) { if (b[len - 1] == 0) { loadPolicy(); handler.send(policyBytes); handler.disconnect(); } } };
static void send(ConnectionHandler handler, byte[] b, int cmd, int cid) { Bytes.setShort(HEAD_TAG, b, 0); Bytes.setShort(b.length - HEAD_SIZE, b, 2); Bytes.setShort(cmd, b, 4); Bytes.setShort(cid, b, 6); handler.send(b); } }
static void send(ConnectionHandler handler, int cmd, int cid) { byte[] head = new byte[8]; Bytes.setShort(HEAD_TAG, head, 0); Bytes.setShort(0, head, 2); Bytes.setShort(cmd, head, 4); Bytes.setShort(cid, head, 6); handler.send(head); }
/** * @param handler {@link ConnectionHandler} to write into * @param begin <code>true</code> to write entire Request or Response, * including Start Line and Headers, * and <code>false</code> to write Body and Trailers (if available) only * @param forceChunked <code>true</code> to force to write in Chunked mode */ public void write(ConnectionHandler handler, boolean begin, boolean forceChunked) { ByteArrayQueue data = new ByteArrayQueue(); write(data, begin, forceChunked); handler.send(data.array(), data.offset(), data.length()); } }
TerminalConnection connection = connectionMap.get(Integer.valueOf(cid)); if (connection != null && packet.size > 0) { connection.handler.send(b, off, packet.size); } else if (logLevel >= LOG_DEBUG) { Log.d("HANDLER_SEND: " + (connection == null ? connection = connectionMap.get(Integer.valueOf(cid)); if (connection != null) { connection.handler.send(b, dataOff, dataLen); } else if (logLevel >= LOG_DEBUG) { Log.d("HANDLER_MULTICAST: Not Found, #" + cid + recv);