@Override public void run() { Data buffer = null; try { while (!stop && (null != (buffer = bufferExs.take()))) { LogExt.d(TAG, "write: " + buffer.getString()); client.sendTCP(buffer); } } catch (InterruptedException e) { e.printStackTrace(); } }
@Override public void run() { Data buffer = null; try { while (!stop && (null != (buffer = bufferExs.take()))) { LogExt.d(TAG, "write: " + buffer.getString()); outputStream.write(buffer.getBytes()); outputStream.flush(); } } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void run() { int size = 0; byte[] buffer = new byte[1024]; Data temp = null; try { while (!stop && ((size = inputStream.read(buffer)) > 0)) { temp = new Data(buffer, 0, size); bufferExs.put(temp); LogExt.d(TAG, "received: " + temp.getString()); } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
@Override public void received(Connection connection, Object object) { LogExt.d(TAG, "received Object " + object); if (object instanceof UpdateNames) { UpdateNames updateNames = (UpdateNames) object; return; } if (object instanceof ChatMessage) { ChatMessage chatMessage = (ChatMessage) object; // chatFrame.addMessage(chatMessage.text); // getCurrentTermSession().write(chatMessage.text); LogExt.d(TAG, "receive text: " + chatMessage.text); if (!TextUtils.isEmpty(chatMessage.text) && chatMessage.text.startsWith(Configuration.CMD_CONNECT_ADB)) { connectLocalServer(IPv4v6Utils.getLocalIPAddress(), Configuration.ADB_SERVER_PORT); String temp = chatMessage.text.substring(Configuration.CMD_CONNECT_ADB.length()).trim(); LogExt.d(TAG, "start connect local adb pc terminal ip is " + temp); // }else if(!TextUtils.isEmpty(chatMessage.text) && // chatMessage.text.startsWith(Configuration.)){ } return; } if (object instanceof Data) { Data bEx = (Data) object; try { mRemoteClientBufferExs.put(bEx); } catch (InterruptedException e) { e.printStackTrace(); } LogExt.d(TAG, "receive bufferEx: " + bEx.getString()); } }