try { this.inbuffer.clear(); this.outbuffer.flush(); try { try { sock.shutdownOutput(); } catch (final IOException ignore) { } try { sock.shutdownInput(); } catch (final IOException ignore) { } } catch (final UnsupportedOperationException ignore) { // if one isn't supported, the other one isn't either } } finally { sock.close(); } } private int fillInputBuffer(final int timeout) throws IOException { final int oldtimeout = this.socket.getSoTimeout();