public class

SocketHttpClientConnection

extends AbstractHttpClientConnection
implements HttpInetConnection
java.lang.Object
   ↳ org.apache.http.impl.AbstractHttpClientConnection
     ↳ org.apache.http.impl.SocketHttpClientConnection
Known Direct Subclasses

Class Overview

Implementation of a client-side HTTP connection that can be bound to a network Socket in order to receive and transmit data.

Summary

Public Constructors
SocketHttpClientConnection()
Public Methods
void close()
Closes this connection gracefully.
InetAddress getLocalAddress()
int getLocalPort()
InetAddress getRemoteAddress()
int getRemotePort()
int getSocketTimeout()
Returns the socket timeout value.
boolean isOpen()
Checks if this connection is open.
void setSocketTimeout(int timeout)
Sets the socket timeout value.
void shutdown()
Force-closes this connection.
Protected Methods
void assertNotOpen()
void assertOpen()
void bind(Socket socket, HttpParams params)
SessionInputBuffer createSessionInputBuffer(Socket socket, int buffersize, HttpParams params)
SessionOutputBuffer createSessionOutputBuffer(Socket socket, int buffersize, HttpParams params)
Socket getSocket()
[Expand]
Inherited Methods
From class org.apache.http.impl.AbstractHttpClientConnection
From class java.lang.Object
From interface org.apache.http.HttpClientConnection
From interface org.apache.http.HttpConnection
From interface org.apache.http.HttpInetConnection

Public Constructors

public SocketHttpClientConnection ()

Public Methods

public void close ()

Closes this connection gracefully. This method will attempt to flush the transmitter's internal buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Use shutdown instead.

Throws
IOException

public InetAddress getLocalAddress ()

public int getLocalPort ()

public InetAddress getRemoteAddress ()

public int getRemotePort ()

public int getSocketTimeout ()

Returns the socket timeout value.

Returns
  • positive value in milliseconds if a timeout is set, 0 if timeout is disabled or -1 if timeout is undefined.

public boolean isOpen ()

Checks if this connection is open.

Returns
  • true if it is open, false if it is closed.

public void setSocketTimeout (int timeout)

Sets the socket timeout value.

Parameters
timeout timeout value in milliseconds

public void shutdown ()

Force-closes this connection. This is the only method of a connection which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.

Throws
IOException

Protected Methods

protected void assertNotOpen ()

protected void assertOpen ()

protected void bind (Socket socket, HttpParams params)

Throws
IOException

protected SessionInputBuffer createSessionInputBuffer (Socket socket, int buffersize, HttpParams params)

Throws
IOException

protected SessionOutputBuffer createSessionOutputBuffer (Socket socket, int buffersize, HttpParams params)

Throws
IOException

protected Socket getSocket ()