Package net.jini.jeri

Examples of net.jini.jeri.Endpoint


          "Access to resolve local host denied");
        }
    }
    resolvedHost = localAddr.getHostAddress();
      }
      Endpoint result = createEndpoint(
    resolvedHost,
    checkCookie(listenContext.addListenEndpoint(listenEndpoint)));
      if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE,
         "enumerate listen endpoints for {0}\nreturns {1}",
View Full Code Here


    public void registerRefs(Endpoint endpoint, Collection refs) {
  super.registerRefs(endpoint, refs);
    }

    protected DgcProxy getDgcProxy(Object endpoint) {
  Endpoint e = (Endpoint) endpoint;
  ObjectEndpoint oe = new BasicObjectEndpoint(e, Jeri.DGC_ID, false);
  InvocationHandler ih = new BasicInvocationHandler(oe, null);
  DgcServer proxy =
      (DgcServer) Proxy.newProxyInstance(getClass().getClassLoader(),
                 proxyInterfaces, ih);
View Full Code Here

      Uuid id)
        throws ExportException
    {
  List bindings = null;
  ObjectTable.Target target = null;
  Endpoint endpoint;
  try {
      LC listenContext = new LC();
      try {
    endpoint =
        serverEndpoint.enumerateListenEndpoints(listenContext);
View Full Code Here

   * Listen on a server endpoint with a no-op dispatcher and a
   * client-side socket factory whose first socket hangs on
   * attempt to read.
   */
  SF sf = new SF();
  final Endpoint ep =
      TcpServerEndpoint.getInstance(null, 0, sf, null)
      .enumerateListenEndpoints(new ListenContext() {
    public ListenCookie addListenEndpoint(ListenEndpoint lep)
        throws IOException
    {
        return lep.listen(new RequestDispatcher() {
      public void dispatch(InboundRequest req) { }
        }).getCookie();
    }
      });

  /*
   * Initiate first request in a separate thread.  We expect it
   * to hang waiting for connection handshake data; wait until
   * we're sure that it is blocking on read.
   */
  Thread t = new Thread(new Runnable() {
      public void run() {
    try {
        System.err.println(
      "Initiating first request asynchronously:");
        ep.newRequest(InvocationConstraints.EMPTY).next();
        System.err.println("First request initiated.");
    } catch (IOException e) {
        e.printStackTrace();
    }
      }
  });
  t.setDaemon(true); // so that test VM exits upon completion
  t.start();
  System.err.println("Waiting for first request initiation to block:");
  synchronized (sf) {
      while (!sf.blocked) {
    sf.wait();
      }
  }
  System.err.println("First request initiation blocked.");

  /*
   * Initiate another request on the same endpoint while the
   * first request initiation is still blocking on the bogus
   * socket; this request should use a normal socket and thus it
   * should return quickly.  If not, then the test will hang
   * (and time out, if run in the harness).
   */
  System.err.println("Initiating second request:");
  ep.newRequest(InvocationConstraints.EMPTY).next();
  System.err.println("Second request initiated.");

  System.err.println("TEST PASSED");
    }
View Full Code Here

  public Endpoint enumerateListenEndpoints(ListenContext lc)
      throws IOException
  {
      ListenEndpoint le = new EvilListenEndpoint();
      lc.addListenEndpoint(le);
      return new Endpoint() {
    public OutboundRequestIterator newRequest(
        InvocationConstraints c)
    {
        throw new AssertionError();
    }
View Full Code Here

     */
    private ConnectionInfo getConnectionInfo(Socket socket,
               InvocationConstraints constraints)
  throws UnsupportedConstraintException
    {
  Endpoint ep =
      getEndpoint(new PrearrangedSocketFactory(socket), constraints);
  ConnManagerFactoryImpl factory = new ConnManagerFactoryImpl();
  endpointInternals.setConnManagerFactory(ep, factory);
  endpointInternals.disableSocketConnect(ep);

  OutboundRequestIterator iter = ep.newRequest(constraints);
  ConnectionInfo ci = factory.getConnectionInfo();
  if (ci != null) {
      return ci;
  }

View Full Code Here

  }
    }

    public static void main(String[] args) throws Exception {
  ServerEndpoint sep = TcpServerEndpoint.getInstance(0);
  Endpoint ep = sep.enumerateListenEndpoints(new ListenContext() {
      public ListenCookie addListenEndpoint(ListenEndpoint lep)
    throws IOException
      {
    return lep.listen(new Dispatcher()).getCookie();
      }
  });
  for (int i = 0; i < 300; i++) {
      ep.newRequest(InvocationConstraints.EMPTY).next();
  }
    }
View Full Code Here

        "TEST FAILED: incorrect constraints returned by " +
        method);
      }
  }

  Endpoint endpoint =
      serverEndpoint.enumerateListenEndpoints(new ListenContext() {
    public ListenCookie addListenEndpoint(ListenEndpoint le)
        throws IOException
    {
        return le.listen(new RD()).getCookie();
    }
      });

  method = "OutboundRequest.getUnfulfilledConstraints";
  System.err.println("\nTesting " + method + ":");
  for (Iterator i = testCases.entrySet().iterator(); i.hasNext();) {
      Map.Entry entry = (Map.Entry) i.next();
      InvocationConstraints c = (InvocationConstraints) entry.getKey();
      System.err.println("  trying: " + c);
      OutboundRequestIterator iter = endpoint.newRequest(c);
      OutboundRequest request = iter.next();
      InvocationConstraints u = request.getUnfulfilledConstraints();
      System.err.println("returned: " + u);
      if (!entry.getValue().equals(u)) {
    throw new RuntimeException(
View Full Code Here

   * asked to connect with a non-zero timeout (as we expect the
   * endpoint to do) always fail as if the timeout has expired,
   * just in case the attempt to connect to the bogus host
   * address would fail for some other reason instead (6391265).
   */
  Endpoint endpoint =
      TcpEndpoint.getInstance(HOST, PORT, new AbstractSocketFactory() {
    public Socket createSocket() throws IOException {
        return new Socket() {
      public void connect(SocketAddress endpoint,
              int timeout)
View Full Code Here

    }

    //inherit javadoc
    public Endpoint enumerateListenEndpoints(ServerEndpoint.ListenContext ctx)
        throws IOException {
        Endpoint e = null;
        TestListenEndpoint tle = new TestListenEndpoint();
        ListenCookie cookie = ctx.addListenEndpoint(tle);
        if (cookie.equals(tle.getListenHandle().getCookie())) {
            if (redirectPort < 0) {
                e = new TestEndpoint(port, host);
View Full Code Here

TOP

Related Classes of net.jini.jeri.Endpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.