final Protocol prot = ctx.getProtocol();
final SelectionKey key = ctx.getSelectionKey();
final SelectorHandler handler = ctx.getSelectorHandler();
final ThreadAttachment currentTA = workerThread.getAttachment();
TargetTuple remote = null;
InetSocketAddress local = null;
X509Certificate[] x509Certs = null;
switch (prot) {
case TCP:
s = ((SocketChannel) key.channel()).socket();
remoteAddress = (InetSocketAddress) s.getRemoteSocketAddress();
remote = new TargetTuple(SipTransports.TCP_PROT, remoteAddress);
local = (InetSocketAddress) s.getLocalSocketAddress();
break;
case UDP:
if (!GrizzlyNetworkManager.useDefaultUDPSelectorHandler){
buffer = (ByteBuffer) ctx.removeAttribute
(GrizzlyNetworkManager.UDP_BUFFER);
} else {
ctx.setKeyRegistrationState(Context.KeyRegistrationState.NONE);
handler.register(key, SelectionKey.OP_READ);
}
DatagramSocket d = ((DatagramChannel) key.channel()).socket();
remoteAddress =
(InetSocketAddress) ctx.getAttribute(ReadFilter.UDP_SOCKETADDRESS);
remote = new TargetTuple(SipTransports.UDP_PROT, remoteAddress);
local = (InetSocketAddress) d.getLocalSocketAddress();
break;
case TLS:
s = ((SocketChannel) key.channel()).socket();
remoteAddress = (InetSocketAddress) s.getRemoteSocketAddress();
remote = new TargetTuple(SipTransports.TLS_PROT, remoteAddress);
local = (InetSocketAddress) s.getLocalSocketAddress();
Object[] certs =
(Object[]) ctx.removeAttribute(GrizzlyNetworkManager.SIP_CERTS);
if ((certs != null) && (certs.length > 0)) {