@Override public void run() { try { mSocketHandler.onAccepted(mSocket); } catch (IOException ex) { LogUtil.w("I/O error: %s", ex); } finally { try { mSocket.close(); } catch (IOException ignore) { } } } }
@Override public void close() { try { if (localSocket.getFileDescriptor() != null) { // close the streams to interrupt pending read and writes localSocket.shutdownInput(); localSocket.shutdownOutput(); } localSocket.close(); } catch (IOException e) { // what could we do? throw new RuntimeException(e); } } }
/** * @throws IOException */ @Override public void close() throws IOException { mLocalSocket.close(); }
@Override public void interrupt() { try { clientSocket.close(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void interrupt() { super.interrupt(); try { socket.close(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void close() throws IOException { socket.close(); serverSocket.close(); } }
private static boolean stopOpenVPN() { synchronized (active) { boolean sendCMD = false; for (OpenVpnManagementThread mt : active) { sendCMD = mt.managmentCommand("signal SIGINT\n"); try { if (mt.mSocket != null) mt.mSocket.close(); } catch (IOException e) { // Ignore close error on already closed socket } } return sendCMD; } }
@Override public void run() { try { mSocketHandler.onAccepted(mSocket); } catch (IOException ex) { LogUtil.w("I/O error: %s", ex.toString()); } finally { try { mSocket.close(); } catch (IOException ignore) { } } } }
@Override public void run() { try { socketHandler.handle(socket.getInputStream(), socket.getOutputStream()); } catch (IOException e) { Log.e(LOG_TAG, "Worker thread error", e); } finally { try { socket.close(); } catch (IOException e) { Log.w(LOG_TAG, "Unable to close socket"); } } } }
client.close(); client = null;
mSocket.close();
} finally { try { socket.close(); } catch (IOException e) {
ls.close(); } catch (IOException e) { Log.e(TAG, "stopSocketServer failed", e);
try { LocalSocket sender = new LocalSocket(); sender.connect(new LocalSocketAddress("MyAddress")); String data = "Hello world!"; Log.d("SENT DATA", data); sender.getOutputStream().write(data.getBytes()); sender.getOutputStream().close(); sender.close(); } catch (IOException ex) { Log.wtf("IOEXCEPTION", ex); }
@Test public void testClose() throws Exception { domainSocket.close(); verify(mockSocket).close(); }
socket.getOutputStream().write(new byte[0]); socket.getOutputStream().close(); socket.close(); } catch (IOException ex) {