Class LinkTcp


  • public class LinkTcp
    extends Link
    Link implementation for TCP.
    • Constructor Detail

      • LinkTcp

        public LinkTcp()
        Create a new TCP link.
    • Method Detail

      • connect

        public void connect​(BrokerURL url)
                     throws javax.jms.JMSException
        Create the physical connection to the Broker.
        Specified by:
        connect in class Link
        Parameters:
        url - the URL of the Broker
        Throws:
        javax.jms.JMSException - if a connection could not be established
      • disconnect

        public void disconnect()
                        throws javax.jms.JMSException
        Close the physical connection to the Broker.
        Specified by:
        disconnect in class Link
        Throws:
        javax.jms.JMSException - if errors occur closing the connection
      • destroy

        public void destroy()
                     throws javax.jms.JMSException
        Cleanup any resources associated with the connection to the Broker.
        Specified by:
        destroy in class Link
        Throws:
        javax.jms.JMSException - if errors occur destroying the connection
      • send

        public void send​(byte[] data,
                         int offset,
                         int length)
                  throws java.io.IOException
        Writes length bytes from the specified byte array starting at offset to the link.
        Specified by:
        send in class Link
        Parameters:
        data - the command data
        offset - the start offset in the data
        length - the number of bytes to write
        Throws:
        java.io.IOException - if an I/O error occurs
      • flush

        public void flush()
                   throws java.io.IOException
        Flushes any data in the output buffer to the socket.
        Specified by:
        flush in class Link
        Throws:
        java.io.IOException - if an error occurs flushing data to the socket
      • recv

        public int recv​(byte[] buf,
                        int offset,
                        int length)
                 throws java.io.IOException
        Reads bytes from the link into the specified byte array, starting at the given offset.
        Specified by:
        recv in class Link
        Parameters:
        buf - destination buffer.
        offset - offset at which to start storing bytes
        length - maximum number of bytes to read
        Returns:
        the number of bytes read, or -1 if the end of the stream has been reached.
        Throws:
        java.io.IOException - if an I/O error occurs
      • getEncryptionLevel

        public int getEncryptionLevel()
                               throws javax.jms.JMSException
        Returns the encryption level of the link.
        Specified by:
        getEncryptionLevel in class Link
        Returns:
        the encryption level
        Throws:
        javax.jms.JMSException - if an error occurs getting the encryption level
      • getServerCertificate

        public java.util.Properties getServerCertificate()
                                                  throws javax.jms.JMSException
        Returns properties of the server certificate. The included property names are: "subjectDn", "issuerDn", "status" "serialNumber", "beginDate", "endDate".
        Specified by:
        getServerCertificate in class Link
        Returns:
        server certificate properties
        Throws:
        javax.jms.JMSException - if an error occurs getting the server certificate