Package org.activeio.net

Examples of org.activeio.net.SocketSynchChannelFactory


   
    private URI serverURI;

    protected ChannelServer createChannelServer(final RequestListener requestListener) throws IOException, URISyntaxException {

        SynchChannelFactory factory = new SocketSynchChannelFactory();
       
        AsynchChannelServer server = new SynchToAsynchChannelServerAdapter(factory.bindSynchChannel(new URI("tcp://localhost:0")));
       
        server.setAcceptListener(new AcceptListener() {
            public void onAccept(Channel channel) {
             
                RequestChannel requestChannel = null;
View Full Code Here


    /**
     * @return
     * @throws IOException
     */
    protected RequestChannel createClientRequestChannel() throws IOException {
        SynchChannelFactory factory = new SocketSynchChannelFactory();
        PacketAggregatingSynchChannel channel = new PacketAggregatingSynchChannel(factory.openSynchChannel(serverURI));
    ((SocketMetadata)channel.narrow(SocketMetadata.class)).setTcpNoDelay(true);
        return new AsynchChannelToClientRequestChannel(channel);
    }
View Full Code Here

        assertNull(type);
        channel.dispose();
    }

    protected void setUp() throws Exception {
        channelFactory = new SocketSynchChannelFactory();
        ThreadedExecutor executor = new ThreadedExecutor();
        executor.setThreadFactory(new ThreadFactory(){
            int count=0;
            public Thread newThread(Runnable arg0) {
                return new Thread(arg0, "activeio:"+(count++));
View Full Code Here

            Thread.currentThread().setContextClassLoader(originalLoader);
        }
    }
   
    private static RequestChannel createRequestChannel(URI target) throws IOException, URISyntaxException {
        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
        SynchChannel channel = factory.openSynchChannel(target);
        SocketMetadata socket = (SocketMetadata) channel.narrow(SocketMetadata.class);
        socket.setTcpNoDelay(true);
        return new AsynchChannelToClientRequestChannel(
                 new PacketAggregatingSynchChannel(
                       channel));       
View Full Code Here

        server.start();
        log.info("Remote login service started on: "+server.getConnectURI()+" clients can connect to: "+server.getConnectURI());
    }
   
    private AsynchChannelServer createAsynchChannelServer() throws IOException, URISyntaxException {
        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
        SynchChannelServer server = factory.bindSynchChannel(bindURI);
        return new SynchToAsynchChannelServerAdapter(server);       
    }
View Full Code Here

    /*
     * Enable this test again once its working.
     */
    public void disabledtest() throws Exception {

        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
        final RequestChannel channel =
            new AsynchChannelToClientRequestChannel(
                AsynchToSynchChannelAdapter.adapt(
                    new SubjectCarryingChannel(
                        new PacketAggregatingAsynchChannel(
                            SynchToAsynchChannelAdapter.adapt(
                                 factory.openSynchChannel(serverURI))))));
        try {
            channel.start();
          Subject.doAs(clientSubject, new PrivilegedExceptionAction() {
              public Object run() throws Exception {

View Full Code Here

        context = new LoginContext("properties", new AbstractTest.UsernamePasswordCallback("izumi", "violin"));
        context.login();
        serverSubject = context.getSubject();

        SocketSynchChannelFactory factory = new SocketSynchChannelFactory();
        server = new SynchToAsynchChannelServerAdapter(
                factory.bindSynchChannel(new URI("tcp://localhost:0")));

        server.setAcceptListener(new AcceptListener() {
            public void onAccept(Channel channel) {
                RequestChannel requestChannel=null;
                try {
View Full Code Here

TOP

Related Classes of org.activeio.net.SocketSynchChannelFactory

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.