if (_channel instanceof SocketChannel) {  Socket socket= ((SocketChannel)_channel).socket(); socket.shutdownOutput(); socket.close(); } _channel.close();
try { if (_channel instanceof SocketChannel) {  Socket socket= ((SocketChannel)_channel).socket(); try { socket.shutdownOutput(); } finally { socket.close(); } } } finally { _channel.close(); }
    public void close() throws IOException    {        if (_channel.isOpen())        {            if (_channel instanceof SocketChannel)            {                // TODO - is this really required?                Socket socket= ((SocketChannel)_channel).socket();                socket.shutdownOutput();                socket.close();            }            _channel.close();        }    }