/** * Create a client transaction from a raw channel. * * @param rawChannel is the transport channel to encapsulate. */ public MessageChannel createMessageChannel(MessageChannel rawChannel) { synchronized (clientTransactions) { // New client transaction to return SIPTransaction returnChannel = createClientTransaction(rawChannel); clientTransactions.add(0, (SIPClientTransaction) returnChannel); ((SIPClientTransaction) returnChannel).setViaPort(rawChannel.getViaPort()); ((SIPClientTransaction) returnChannel).setViaHost(rawChannel.getHost()); // Add the transaction timer for the state machine. returnChannel.startTransactionTimer(); return returnChannel; } }
/** * Get an identifying key. This key is used to cache the connection and re-use it if necessary. */ public String getKey() { if (this.key != null) { return this.key; } else { this.key = MessageChannel.getKey(this.peerAddress, this.peerPort, "TLS"); return this.key; } }
/** * Constructor - connects to the given inet address. Acknowledgement -- Lamine Brahimi (IBM * Zurich) sent in a bug fix for this method. A thread was being uncessarily created. * * @param inetAddr inet address to connect to. * @param sipStack is the sip stack from which we are created. * @throws IOException if we cannot connect. */ protected TLSMessageChannel( InetAddress inetAddr, int port, SIPMessageStack sipStack, TLSMessageProcessor messageProcessor) throws IOException { if (LogWriter.needsLogging) { sipStack.logWriter.logMessage("creating new TLSMessageChannel "); sipStack.logWriter.logStackTrace(); } this.peerAddress = inetAddr; this.peerPort = port; this.myPort = messageProcessor.getPort(); this.peerProtocol = "TLS"; this.stack = sipStack; this.tlsMessageProcessor = messageProcessor; this.myAddress = sipStack.getHostAddress(); // Bug report by Vishwashanti Raj Kadiayl this.key = MessageChannel.getKey(peerAddress, peerPort, "TLS"); super.messageProcessor = messageProcessor; }