com.rabbitmq.client.impl
public class SocketFrameHandler extends java.lang.Object implements FrameHandler
Modifier and Type | Field and Description |
---|---|
static int |
SOCKET_CLOSING_TIMEOUT
Time to linger before closing the socket forcefully.
|
Constructor and Description |
---|
SocketFrameHandler(java.net.Socket socket) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying data connection (complaint not permitted).
|
void |
flush()
Flush the underlying data connection.
|
java.net.InetAddress |
getAddress()
Retrieve address of peer.
|
java.io.DataInputStream |
getInputStream() |
java.net.InetAddress |
getLocalAddress()
Retrieve the local host.
|
int |
getLocalPort()
Retrieve the local port number.
|
int |
getPort()
Retrieve port number of peer.
|
int |
getTimeout()
Get the underlying socket's read timeout in milliseconds.
|
Frame |
readFrame()
Read a
Frame from the underlying data connection. |
void |
sendHeader()
Send the initial connection header, thus kickstarting the AMQP
protocol version negotiation process and putting the underlying
connection in a state such that the next layer of startup can
proceed.
|
void |
sendHeader(int major,
int minor)
Write a 0-8-style connection header to the underlying socket,
containing the specified version information, kickstarting the
AMQP protocol version negotiation process.
|
void |
sendHeader(int major,
int minor,
int revision)
Write a 0-9-1-style connection header to the underlying socket,
containing the specified version information, kickstarting the
AMQP protocol version negotiation process.
|
void |
setTimeout(int timeoutMs)
Set the underlying socket's read timeout in milliseconds, if applicable.
|
void |
writeFrame(Frame frame)
Write a
Frame to the underlying data connection. |
public static final int SOCKET_CLOSING_TIMEOUT
public SocketFrameHandler(java.net.Socket socket) throws java.io.IOException
socket
- the socket to usejava.io.IOException
public java.net.InetAddress getAddress()
NetworkConnection
getAddress
in interface NetworkConnection
public java.net.InetAddress getLocalAddress()
NetworkConnection
getLocalAddress
in interface NetworkConnection
public java.io.DataInputStream getInputStream()
public int getPort()
NetworkConnection
getPort
in interface NetworkConnection
public int getLocalPort()
NetworkConnection
getLocalPort
in interface NetworkConnection
public void setTimeout(int timeoutMs) throws java.net.SocketException
FrameHandler
setTimeout
in interface FrameHandler
timeoutMs
- The timeout in millisecondsjava.net.SocketException
public int getTimeout() throws java.net.SocketException
FrameHandler
getTimeout
in interface FrameHandler
java.net.SocketException
public void sendHeader(int major, int minor) throws java.io.IOException
major
- major protocol version numberminor
- minor protocol version numberjava.io.IOException
- if there is a problem accessing the connectionsendHeader()
public void sendHeader(int major, int minor, int revision) throws java.io.IOException
major
- major protocol version numberminor
- minor protocol version numberrevision
- protocol revision numberjava.io.IOException
- if there is a problem accessing the connectionsendHeader()
public void sendHeader() throws java.io.IOException
FrameHandler
sendHeader
in interface FrameHandler
java.io.IOException
- if there is a problem accessing the connectionpublic Frame readFrame() throws java.io.IOException
FrameHandler
Frame
from the underlying data connection.readFrame
in interface FrameHandler
java.io.IOException
- if there is a problem accessing the connectionjava.net.SocketTimeoutException
- if the underlying read times outpublic void writeFrame(Frame frame) throws java.io.IOException
FrameHandler
Frame
to the underlying data connection.writeFrame
in interface FrameHandler
frame
- the Frame to transmitjava.io.IOException
- if there is a problem accessing the connectionpublic void flush() throws java.io.IOException
FrameHandler
flush
in interface FrameHandler
java.io.IOException
- if there is a problem accessing the connectionpublic void close()
FrameHandler
close
in interface FrameHandler