public AbstractHttpClientConnection() { super(); this.entityserializer = createEntitySerializer(); this.entitydeserializer = createEntityDeserializer(); }
public AbstractHttpServerConnection() { super(); this.entityserializer = createEntitySerializer(); this.entitydeserializer = createEntityDeserializer(); }
@Override public Socket getSocket() { return super.getSocket(); } }
@Override protected ConnectionReuseStrategy createConnectionReuseStrategy() { return new DefaultConnectionReuseStrategy(); }
protected HttpResponseFactory createHttpResponseFactory() { return new DefaultHttpResponseFactory(); }
public HttpRequest receiveRequestHeader() throws HttpException, IOException { assertOpen(); HttpRequest request = (HttpRequest) this.requestParser.parse(); this.metrics.incrementRequestCount(); return request; }
public void sendRequestHeader(final HttpRequest request) throws HttpException, IOException { if (request == null) { throw new IllegalArgumentException("HTTP request may not be null"); } assertOpen(); this.requestWriter.write(request); this.metrics.incrementRequestCount(); }
public HttpResponse receiveResponseHeader() throws HttpException, IOException { assertOpen(); HttpResponse response = (HttpResponse) this.responseParser.parse(); if (response.getStatusLine().getStatusCode() >= 200) { this.metrics.incrementResponseCount(); } return response; }
public void flush() throws IOException { assertOpen(); doFlush(); }
public void flush() throws IOException { assertOpen(); doFlush(); }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("["); if (isOpen()) { buffer.append(getRemotePort()); } else { buffer.append("closed"); } buffer.append("]"); return buffer.toString(); }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("["); if (isOpen()) { buffer.append(getRemotePort()); } else { buffer.append("closed"); } buffer.append("]"); return buffer.toString(); }
public void setSocketTimeout(int timeout) { assertOpen(); if (this.socket != null) { try { this.socket.setSoTimeout(timeout); } catch (SocketException ignore) { // It is not quite clear from the Sun's documentation if there are any // other legitimate cases for a socket exception to be thrown when setting // SO_TIMEOUT besides the socket being already closed } } }
public void setSocketTimeout(int timeout) { assertOpen(); if (this.socket != null) { try { this.socket.setSoTimeout(timeout); } catch (SocketException ignore) { // It is not quite clear from the Sun's documentation if there are any // other legitimate cases for a socket exception to be thrown when setting // SO_TIMEOUT besides the socket being already closed } } }
public boolean isStale() { assertOpen(); try { this.inbuffer.isDataAvailable(1); return false; } catch (IOException ex) { return true; } }
@Override public void close() throws IOException { log.debug("Connection closed"); super.close(); }
protected HttpRequestFactory createHttpRequestFactory() { return new DefaultHttpRequestFactory(); }
@Override protected InputStream getSocketInputStream(final Socket socket) throws IOException { Recorder recorder = Recorder.getHttpRecorder(); if (recorder != null) { // XXX || (isSecure() && isProxied())) { return recorder.inputWrap(super.getSocketInputStream(socket)); } else { return super.getSocketInputStream(socket); } }
@Override protected OutputStream getSocketOutputStream(final Socket socket) throws IOException { Recorder recorder = Recorder.getHttpRecorder(); if (recorder != null) { // XXX || (isSecure() && isProxied())) { return recorder.outputWrap(super.getSocketOutputStream(socket)); } else { return super.getSocketOutputStream(socket); } }
@Override public SSLSession getSSLSession() { final Socket socket = super.getSocket(); if (socket instanceof SSLSocket) { return ((SSLSocket) socket).getSession(); } else { return null; } }