to top
Android APIs
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 ()

Since: API Level 1

Public Methods

public void close ()

Since: API Level 1

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 ()

Since: API Level 1

public int getLocalPort ()

Since: API Level 1

public InetAddress getRemoteAddress ()

Since: API Level 1

public int getRemotePort ()

Since: API Level 1

public int getSocketTimeout ()

Since: API Level 1

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 ()

Since: API Level 1

Checks if this connection is open.

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

public void setSocketTimeout (int timeout)

Since: API Level 1

Sets the socket timeout value.

Parameters
timeout timeout value in milliseconds

public void shutdown ()

Since: API Level 1

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 ()

Since: API Level 1

protected void assertOpen ()

Since: API Level 1

protected void bind (Socket socket, HttpParams params)

Since: API Level 1

Throws
IOException

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

Since: API Level 1

Throws
IOException

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

Since: API Level 1

Throws
IOException

protected Socket getSocket ()

Since: API Level 1