Methods Summary |
---|
protected void | assertNotOpen()
if (this.open) {
throw new IllegalStateException("Connection is already open");
}
|
protected void | assertOpen()
if (!this.open) {
throw new IllegalStateException("Connection is not open");
}
|
protected void | bind(java.net.Socket socket, org.apache.http.params.HttpParams params)
if (socket == null) {
throw new IllegalArgumentException("Socket may not be null");
}
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
this.socket = socket;
int buffersize = HttpConnectionParams.getSocketBufferSize(params);
init(
createHttpDataReceiver(socket, buffersize, params),
createHttpDataTransmitter(socket, buffersize, params),
params);
this.open = true;
|
public void | close()
if (!this.open) {
return;
}
this.open = false;
doFlush();
try {
this.socket.shutdownOutput();
} catch (IOException ignore) {
}
try {
this.socket.shutdownInput();
} catch (IOException ignore) {
}
this.socket.close();
|
protected org.apache.http.io.SessionInputBuffer | createHttpDataReceiver(java.net.Socket socket, int buffersize, org.apache.http.params.HttpParams params)
return new SocketInputBuffer(socket, buffersize, params);
|
protected org.apache.http.io.SessionOutputBuffer | createHttpDataTransmitter(java.net.Socket socket, int buffersize, org.apache.http.params.HttpParams params)
return new SocketOutputBuffer(socket, buffersize, params);
|
public java.net.InetAddress | getLocalAddress()
if (this.socket != null) {
return this.socket.getLocalAddress();
} else {
return null;
}
|
public int | getLocalPort()
if (this.socket != null) {
return this.socket.getLocalPort();
} else {
return -1;
}
|
public java.net.InetAddress | getRemoteAddress()
if (this.socket != null) {
return this.socket.getInetAddress();
} else {
return null;
}
|
public int | getRemotePort()
if (this.socket != null) {
return this.socket.getPort();
} else {
return -1;
}
|
protected java.net.Socket | getSocket()
return this.socket;
|
public int | getSocketTimeout()
if (this.socket != null) {
try {
return this.socket.getSoTimeout();
} catch (SocketException ignore) {
return -1;
}
} else {
return -1;
}
|
public boolean | isOpen()
return this.open;
|
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 | shutdown()
this.open = false;
Socket tmpsocket = this.socket;
if (tmpsocket != null) {
tmpsocket.close();
}
|