Package org.activeio.adapter

Examples of org.activeio.adapter.AsyncChannelToClientRequestChannel


    private static RequestChannel createRequestChannel(URI target) throws IOException, URISyntaxException {
        SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
        SyncChannel channel = factory.openSyncChannel(target);
        SocketMetadata socket = (SocketMetadata) channel.narrow(SocketMetadata.class);
        socket.setTcpNoDelay(true);
        return new AsyncChannelToClientRequestChannel(
                 new PacketAggregatingSyncChannel(
                       channel));       
    }
View Full Code Here


     */
    public void disabledtest() throws Exception {

        SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
        final RequestChannel channel =
            new AsyncChannelToClientRequestChannel(
                AsyncToSyncChannel.adapt(
                    new SubjectCarryingChannel(
                        new PacketAggregatingAsyncChannel(
                            SyncToAsyncChannel.adapt(
                                 factory.openSyncChannel(serverURI))))));
        try {
            channel.start();
          Subject.doAs(clientSubject, new PrivilegedExceptionAction() {
              public Object run() throws Exception {

                  Subject subject = Subject.getSubject(AccessController.getContext());
                  String p = subject.getPrincipals().iterator().next().toString();
                  log.info("Sending request as: "+p);

                    Packet request = new ByteArrayPacket("whoami".getBytes());
                    Packet response = channel.request(request, 1000*5*1000);

                    assertNotNull(response);
                    assertEquals( p, new String(response.sliceAsBytes()) );
                    return null;
              }
          });
        } finally {
            channel.dispose();
        }
    }
View Full Code Here

TOP

Related Classes of org.activeio.adapter.AsyncChannelToClientRequestChannel

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.