private void checkConnectPermission() throws SecurityException {
  SecurityManager security=System.getSecurityManager();
  if (security == null)   return;
  if (security != cacheSecurityManager) {
    okContext=null;
    authcache=new WeakHashMap<AccessControlContext,Reference<AccessControlContext>>();
    cacheSecurityManager=security;
  }
  AccessControlContext ctx=AccessController.getContext();
  if (okContext == null || !(okContext.equals(ctx) || authcache.containsKey(ctx))) {
    security.checkConnect(ep.getHost(),ep.getPort());
    authcache.put(ctx,new SoftReference<AccessControlContext>(ctx));
  }
  okContext=ctx;
}

private void checkConnectPermission ( ) throws SecurityException { SecurityManager security = System . getSecurityManager ( ) ; if ( security == null ) return ; if ( security != cacheSecurityManager ) { okContext = null ; authcache = new WeakHashMap < AccessControlContext , Reference < AccessControlContext > > ( ) ; cacheSecurityManager = security ; } AccessControlContext ctx = AccessController . getContext ( ) ; if ( okContext == null || ! ( okContext . equals ( ctx ) || authcache . containsKey ( ctx ) ) ) { security . checkConnect ( ep . getHost ( ) , ep . getPort ( ) ) ; authcache . put ( ctx , new SoftReference < AccessControlContext > ( ctx ) ) ; } okContext = ctx ; }
checks if the current caller has sufficient privilege to make a connection to the remote endpoint .
