javapns.communication
Class ConnectionToAppleServer

java.lang.Object
  extended by javapns.communication.ConnectionToAppleServer
Direct Known Subclasses:
ConnectionToFeedbackServer, ConnectionToNotificationServer

public abstract class ConnectionToAppleServer
extends Object

Class representing an abstract connection to an Apple server

Communication protocol differences between Notification and Feedback servers are implemented in ConnectionToNotificationServer and ConnectionToFeedbackServer.

Author:
Sylvain Pedneault

Field Summary
static String KEYSTORE_TYPE_JKS
           
static String KEYSTORE_TYPE_PKCS12
           
 
Constructor Summary
ConnectionToAppleServer(AppleServer server)
          Builds a connection to an Apple server.
ConnectionToAppleServer(AppleServer server, KeyStore keystore)
          Builds a connection to an Apple server.
 
Method Summary
 SSLSocketFactory createSSLSocketFactory()
          Return a SSLSocketFactory for creating sockets to communicate with Apple.
 KeyStore getKeystore()
           
static String getKeystoreType()
           
 AppleServer getServer()
           
abstract  String getServerHost()
           
abstract  int getServerPort()
           
 SSLSocket getSSLSocket()
          Create a SSLSocket which will be used to send data to Apple
 SSLSocketFactory getSSLSocketFactory()
           
 void setKeystore(KeyStore ks)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYSTORE_TYPE_PKCS12

public static final String KEYSTORE_TYPE_PKCS12
See Also:
Constant Field Values

KEYSTORE_TYPE_JKS

public static final String KEYSTORE_TYPE_JKS
See Also:
Constant Field Values
Constructor Detail

ConnectionToAppleServer

public ConnectionToAppleServer(AppleServer server)
                        throws KeystoreException
Builds a connection to an Apple server.

Parameters:
server - connection details
Throws:
KeystoreException - thrown if an error occurs when loading the keystore

ConnectionToAppleServer

public ConnectionToAppleServer(AppleServer server,
                               KeyStore keystore)
Builds a connection to an Apple server.

Parameters:
server - connection details
keystore -
Method Detail

getServer

public AppleServer getServer()

getKeystore

public KeyStore getKeystore()

setKeystore

public void setKeystore(KeyStore ks)

getServerHost

public abstract String getServerHost()

getServerPort

public abstract int getServerPort()

createSSLSocketFactory

public SSLSocketFactory createSSLSocketFactory()
                                        throws KeystoreException
Return a SSLSocketFactory for creating sockets to communicate with Apple.

Returns:
SSLSocketFactory
Throws:
KeystoreException

getSSLSocketFactory

public SSLSocketFactory getSSLSocketFactory()
                                     throws KeystoreException
Throws:
KeystoreException

getSSLSocket

public SSLSocket getSSLSocket()
                       throws KeystoreException,
                              CommunicationException
Create a SSLSocket which will be used to send data to Apple

Returns:
the SSLSocket
Throws:
KeystoreException
CommunicationException

getKeystoreType

public static String getKeystoreType()