/** * Stops the listener thread and unbinds the address. */ public void stop() { synchronized (this) { mStopped = true; if (mListenerThread == null) { return; } } mListenerThread.interrupt(); try { if (mServerSocket != null) { mServerSocket.close(); } } catch (IOException e) { // Don't care... } }
public void shutdown() { if (serverSocket != null) { try { serverSocket.close(); } catch (IOException ignore) { } serverSocket = null; } }
Log.v(Logging.LOG_TAG, "Stopping server: too many wrong token connections"); Server.this.serverSocket.close(); break;
/** * @throws IOException */ @Override public void close() throws IOException { mLocalServerSocket.close(); mClosed = true; }
private void stopServer() { if (serverSocket != null) { try { serverSocket.close(); } catch (IOException e) { e.printStackTrace(); } } }
@Override public void interrupt() { super.interrupt(); try { acceptor.close(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void close() throws IOException { socket.close(); serverSocket.close(); } }
@Override public void onDestroy() { super.onDestroy(); Log.i(TAG, "Stopping service"); stopForeground(true); if (acceptor != null) { try { acceptor.close(); } catch (IOException e) { // We don't care } } try { executor.shutdownNow(); executor.awaitTermination(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // Too bad } finally { started = false; // Unfortunately, we have no way to clean up some Binder-based callbacks // (namely IRotationWatcher) on lower API levels without killing the process, // which will allow DeathRecipient to handle it on their side. Process.killProcess(Process.myPid()); } }
protected void closeSockets() { try { mReceiver.close(); } catch (Exception e) { e.printStackTrace(); } try { mSender.close(); } catch (Exception e) { e.printStackTrace(); } try { mLss.close(); } catch (Exception e) { e.printStackTrace(); } mLss = null; mSender = null; mReceiver = null; }
/** * Stops the listener thread and unbinds the address. */ public void stop() { synchronized (this) { mStopped = true; if (mListenerThread == null) { return; } } mListenerThread.interrupt(); try { if (mServerSocket != null) { LogUtil.e("Trying to unbind local socket"); mServerSocket.close(); LogUtil.e("Local socket closed"); } } catch (IOException e) { LogUtil.e(e.toString()); // Don't care... } }
mLss.close(); } catch (Exception e) { e.printStackTrace();
mLss.close(); } catch (Exception e) { e.printStackTrace();
if (mServer != null) { try { mServer.close(); } catch (IOException e) {
mServerSocket.close(); } catch (IOException e) { VpnStatus.logException(e);
@Override public void run() { String socketName = acceptor.getLocalSocketAddress().getName(); Log.i(TAG, String.format("Server listening on @%s", socketName)); try { while (!isInterrupted()) { Connection conn = new Connection(acceptor.accept()); executor.submit(conn); } } catch (IOException e) { } finally { Log.i(TAG, "Server stopping"); try { acceptor.close(); } catch (IOException e) { } stopSelf(); } }
@Test public void testClose() throws Exception { domainServerSocket.close(); verify(mockServerSocket).close(); }
server.close(); } catch (IOException ex) { Log.wtf("IOEXCEPTION", ex);
if (localServerSocket !=null) { try { localServerSocket.close(); sender.close(); receiver.close();