|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.tls.ssl30.SSL30Connection
public class SSL30Connection
This class can be used to instantiate a SSL3.0 connection directly given an underlying connection (such as TCP)
or it can be instantiated using Connector.open
and specifying ssl as the protocol to use.
Field Summary |
---|
Fields inherited from interface net.rim.device.api.io.SocketConnectionEnhanced |
---|
READ_TIMEOUT |
Constructor Summary | ||
---|---|---|
|
SSL30Connection(StreamConnection subConnection,
String name)
Creates an instance of the SSL protocol passing in an underlying stream connection and the address you are connecting to. |
|
|
SSL30Connection(StreamConnection subConnection,
String name,
boolean startHandshake)
Creates an instance of the SSL protocol passing in an underlying stream connection and the address you are connecting to. |
Method Summary | ||
---|---|---|
|
void |
close()
Close the connection. |
|
void |
connectionClosed(ConnectionCloseProvider connection)
Called when a connection is closed. |
|
boolean |
connectionStatusAvailable()
Returns if the connections status is available. |
|
String |
getAddress()
Gets the remote address to which the socket is bound. |
|
String |
getLocalAddress()
Gets the local address to which the socket is bound. |
|
int |
getLocalPort()
Returns the local port to which this socket is bound. |
|
StreamConnection |
getParentStream()
Returns the parent stream if it is available. |
|
int |
getPort()
Returns the remote port to which this socket is bound. |
|
SecurityInfo |
getSecurityInfo()
Return the security information associated with this connection. |
|
int |
getSocketOption(byte option)
Get a socket option for the connection. |
|
long |
getSocketOptionEx(short option)
Get a socket option for this connection. |
|
boolean |
isConnectionEstablished()
Returns if the connection is established or not. |
|
DataInputStream |
openDataInputStream()
Returns a data input stream to use for retrieving data from the TLS stream. |
|
DataOutputStream |
openDataOutputStream()
Returns a data output stream for writing data to the stream securely using TLS. |
|
InputStream |
openInputStream()
Returns the input stream where one would read information from when it is being sent through the protocol. |
|
OutputStream |
openOutputStream()
Returns the output stream to use when sending data using this protocol. |
|
void |
setConnectionCloseListener(ConnectionCloseListener listener)
Sets the current close listener. |
|
void |
setSocketOption(byte option,
int value)
Set a socket option for the connection. |
|
void |
setSocketOptionEx(short option,
long value)
Set a socket option for this connection. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SSL30Connection(StreamConnection subConnection, String name) throws IOException, TLSException
This creates the protocol and calls connect which will establish the connection with the server using SSL.
To use the connection call the getInputStream
and getOutputStream
methods.
subConnection
- An ordered stream connection such as a TCP connection which will provide the underlying
transport for this protocol.name
- The URL of the server that was passed into the subConnection constructor or the domain name.
IOException
- Thrown if an I/O error occurs.
TLSException
- Thrown if a TLS error occurs.public SSL30Connection(StreamConnection subConnection, String name, boolean startHandshake) throws IOException, TLSException
This creates the protocol and calls connect which will establish the connection with the server using SSL.
To use the connection call the getInputStream
and getOutputStream
methods.
subConnection
- An ordered stream connection such as a TCP connection which will provide the underlying
transport for this protocol.name
- The URL of the server that was passed into the subConnection constructor or the domain name.startHandshake
- If this boolean is true, then the handshake will be completed before this function
is finished. If it is false, then the handshake is completed when required.
IOException
- Thrown if an I/O error occurs.
TLSException
- Thrown if a TLS error occurs.Method Detail |
---|
public InputStream openInputStream() throws IOException
InputStream
.
IOException
- Thrown if an I/O error occurs or if the connection
is already closed.public DataInputStream openDataInputStream() throws IOException
DataInputStream
.
IOException
- Thrown if an I/O error occurs or if the connection
is already closed.public OutputStream openOutputStream() throws IOException
OutputStream
.
IOException
- Thrown if an I/O error occurs or if the connection
is already closed.public DataOutputStream openDataOutputStream() throws IOException
DataOutputStream
.
IOException
- Thrown if an I/O error occurs or if the connection
is already closed.public void close() throws IOException
When the connection has been closed access to all methods except this one will cause an an IOException to be thrown.
Closing an already closed connection has no effect. Streams derived from the connection may be open when method is called. Any open streams will cause the connection to be held open until they themselves are closed.
IOException
- Thrown if an I/O error occurs.public SecurityInfo getSecurityInfo() throws IOException
Setup
state then
the connection is initiated to establish the secure connection
to the server. The method returns when the connection is
established and the Certificate
supplied by the
server has been validated.
The SecurityInfo
is only returned if the
connection has been successfully made to the server.
IOException
- Thrown if an I/O error occurs or if the connection
is already closed.public void setSocketOption(byte option, int value) throws IllegalArgumentException, IOException
Options inform the low level networking code about intended usage patterns that the application will use in dealing with the socket connection.
Calling setSocketOption
to assign buffer sizes
is a hint to the platform of the sizes to set the underlying
network I/O buffers.
Calling getSocketOption
can be used to see what
sizes the system is using.
The system MAY adjust the buffer sizes to account for
better throughput available from Maximum Transmission Unit
(MTU) and Maximum Segment Size (MSS) data available
from current network information.
option
- socket option identifier (KEEPALIVE, LINGER,
SNDBUF, RCVBUF, or DELAY)value
- numeric value for specified option
IllegalArgumentException
- if the value is not
valid (e.g. negative value) or if the option
identifier is not valid
IOException
- if the connection was closedSSL30Connection.getSocketOption(byte)
public int getSocketOption(byte option) throws IllegalArgumentException, IOException
option
- socket option identifier (KEEPALIVE, LINGER,
SNDBUF, RCVBUF, or DELAY)
IllegalArgumentException
- if the option identifier is
not valid
IOException
- if the connection was closedSSL30Connection.setSocketOption(byte, int)
public String getLocalAddress() throws IOException
The host address(IP number) that can be used to connect to this end of the socket connection from an external system. Since IP addresses may be dynamically assigned, a remote application will need to be robust in the face of IP number reasssignment.
The local hostname (if available) can be accessed from
System.getProperty("microedition.hostname")
IOException
- if the connection was closed.ServerSocketConnection
public int getLocalPort() throws IOException
IOException
- if the connection was closed.ServerSocketConnection
public String getAddress() throws IOException
IOException
- if the connection was closed.public int getPort() throws IOException
IOException
- if the connection was closed.public StreamConnection getParentStream()
getParentStream
in interface ParentStreamProvider
public boolean connectionStatusAvailable()
connectionStatusAvailable
in interface ConnectionCloseProvider
public boolean isConnectionEstablished()
isConnectionEstablished
in interface ConnectionCloseProvider
public void setConnectionCloseListener(ConnectionCloseListener listener)
setConnectionCloseListener
in interface ConnectionCloseProvider
listener
- The listener to be notified if this connection closes.public void connectionClosed(ConnectionCloseProvider connection)
connectionClosed
in interface ConnectionCloseListener
connection
- The connection that was closed.public void setSocketOptionEx(short option, long value) throws IllegalArgumentException, IOException
setSocketOptionEx
in interface SocketConnectionEnhanced
option
- socket option identifiervalue
- value for specified option
IllegalArgumentException
- if the value is not
valid (e.g. negative value) or if the option
identifier is not valid
IOException
- if the connection was closedSSL30Connection.getSocketOptionEx(short)
public long getSocketOptionEx(short option) throws IllegalArgumentException, IOException
getSocketOptionEx
in interface SocketConnectionEnhanced
option
- socket option identifier
IllegalArgumentException
- if the option identifier is
not valid
IOException
- if the connection was closedSSL30Connection.setSocketOptionEx(short, long)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.