class SocketWrapper implements ResourcePool.Resource {

  public void close() {
    if (!m_socket.isClosed()) {
      // Java provides no way for socket code to enquire whether the
      // peer has closed the connection. We make an effort to tell the
      // peer.
      synchronized (m_outputStream) {
        new StreamSender(m_outputStream).shutdown();
      }

      Closer.close(m_socket);

      // Close before informing listeners to prevent recursion.
      m_closedListeners.apply(m_closedInformer);
    }
  }

  public  SocketWrapper(Socket socket);

}