public class GoogleRelayedCandidateSocket extends DelegatingSocket
Modifier and Type | Class and Description |
---|---|
protected class |
GoogleRelayedCandidateSocket.TCPOutputStream
TCP output stream for TCP socket.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
closed
The indicator which determines whether this instance has started
executing or has executed its
close() method. |
private static Logger |
logger
The Logger used by the
GoogleRelayedCandidateSocket class and its instances for
logging output.
|
private GoogleRelayedCandidateSocket.TCPOutputStream |
outputStream
The OutputStream.
|
private GoogleRelayedCandidate |
relayedCandidate
The GoogleRelayedCandidate which uses this instance as the value
of its socket property.
|
private GoogleRelayedCandidateDelegate |
socketDelegate
The GoogleTurnCandidateDelegage which will handle send/receive
operations.
|
channel, delegate
Constructor and Description |
---|
GoogleRelayedCandidateSocket(GoogleRelayedCandidate relayedCandidate,
GoogleTurnCandidateHarvest turnCandidateHarvest,
String username)
Initializes a new GoogleRelayedCandidateSocket instance
which is to be the socket of a specific
RelayedCandidate harvested by a specific
TurnCandidateHarvest.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this datagram socket.
|
InetAddress |
getLocalAddress()
Gets the local address to which the socket is bound.
|
int |
getLocalPort()
Returns the port number on the local host to which this socket is bound.
|
InetSocketAddress |
getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or
null if it is not bound yet.
|
OutputStream |
getOutputStream() |
GoogleRelayedCandidate |
getRelayedCandidate()
Gets the RelayedCandidate which uses this instance as the value
of its socket property.
|
void |
processResponse(StunResponseEvent response)
Dispatch the specified response.
|
void |
processSuccess(Response response,
Request request)
Notifies this GoogleRelayedCandidateSocket that a
specific Request it has sent has received a STUN success
Response.
|
void |
receive(DatagramPacket p)
Receives a datagram packet from this socket.
|
void |
send(DatagramPacket p)
Sends a datagram packet from this socket.
|
bind, connect, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, receiveFromInputStream, sendUrgentData, setKeepAlive, setOOBInline, setOriginalInputStream, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
setSocketImplFactory
private static final Logger logger
private boolean closed
close()
method.private final GoogleRelayedCandidate relayedCandidate
private final GoogleRelayedCandidateDelegate socketDelegate
private GoogleRelayedCandidateSocket.TCPOutputStream outputStream
public GoogleRelayedCandidateSocket(GoogleRelayedCandidate relayedCandidate, GoogleTurnCandidateHarvest turnCandidateHarvest, String username) throws SocketException
relayedCandidate
- the RelayedCandidate which is to use the
new instance as the value of its socket propertyturnCandidateHarvest
- the TurnCandidateHarvest which has
harvested relayedCandidateusername
- usernameSocketException
- if anything goes wrong while initializing the new
GoogleRelayedCandidateSocket instancepublic void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class DelegatingSocket
Socket.close()
public InetAddress getLocalAddress()
If there is a security manager, its checkConnect method is first called with the host address and -1 as its arguments to see if the operation is allowed.
getLocalAddress
in class DelegatingSocket
getLocalSocketAddress()
,
Socket.getLocalAddress()
public int getLocalPort()
getLocalPort
in class DelegatingSocket
getLocalSocketAddress()
,
Socket.getLocalPort()
public InetSocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class DelegatingSocket
Socket.getLocalSocketAddress()
public final GoogleRelayedCandidate getRelayedCandidate()
public void processSuccess(Response response, Request request)
response
- the Response which responds to requestrequest
- the Request sent by this instance to which
response respondspublic void processResponse(StunResponseEvent response)
response
- the response to dispatch.public void receive(DatagramPacket p) throws IOException
receive
in class DelegatingSocket
p
- the DatagramPacket into which to place the incoming
dataIOException
- if an I/O error occursDelegatingSocket.receive(DatagramPacket)
public void send(DatagramPacket p) throws IOException
send
in class DelegatingSocket
p
- the DatagramPacket to be sentIOException
- if an I/O error occurspublic OutputStream getOutputStream() throws IOException
getOutputStream
in class DelegatingSocket
IOException
Copyright © 2018. All rights reserved.