public class SocketFrameHandler extends java.lang.Object implements FrameHandler
Modifier and Type | Field and Description |
---|---|
java.io.DataInputStream |
_inputStream
Socket's inputstream - data from the broker
|
java.io.DataOutputStream |
_outputStream
Socket's outputstream - data to the broker
|
java.net.Socket |
_socket
The underlying socket
|
Constructor and Description |
---|
SocketFrameHandler(java.net.Socket socket) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying data connection (complaint not permitted).
|
java.net.InetAddress |
getAddress()
Retrieve address of peer.
|
int |
getPort()
Retrieve port number of peer.
|
int |
getTimeout()
Get the underlying socket's timeout in milliseconds.
|
Frame |
readFrame()
Read a
Frame from the underlying socket. |
void |
sendHeader()
Write a connection header to the underlying socket, containing
the protocol version supported by this code, kickstarting the
AMQP protocol version negotiation process.
|
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 socket. |
public final java.net.Socket _socket
public final java.io.DataInputStream _inputStream
public final java.io.DataOutputStream _outputStream
public SocketFrameHandler(java.net.Socket socket) throws java.io.IOException
socket
- the socket to usejava.io.IOException
public java.net.InetAddress getAddress()
FrameHandler
getAddress
in interface FrameHandler
public int getPort()
FrameHandler
getPort
in interface FrameHandler
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 connectionFrameHandler.sendHeader()
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 connectionFrameHandler.sendHeader()
public void sendHeader() throws java.io.IOException
sendHeader
in interface FrameHandler
java.io.IOException
- if there is a problem accessing the connectionFrameHandler.sendHeader()
public Frame readFrame() throws java.io.IOException
Frame
from the underlying socket.readFrame
in interface FrameHandler
java.io.IOException
- if there is a problem accessing the connectionFrameHandler.readFrame()
public void writeFrame(Frame frame) throws java.io.IOException
Frame
to the underlying socket.writeFrame
in interface FrameHandler
frame
- an incoming Frame, or null if there is nonejava.io.IOException
- if there is a problem accessing the connectionFrameHandler.writeFrame(Frame frame)
public void close()
FrameHandler
close
in interface FrameHandler