Search in sources :

Example 1 with WriteRequest

use of org.apache.mina.core.write.WriteRequest in project karaf by apache.

the class KarafJaasAuthenticatorTest method init.

@Before
public void init() throws Exception {
    configuration = Configuration.getConfiguration();
    Configuration.setConfiguration(new Configuration() {

        @Override
        public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
            return new AppConfigurationEntry[] { new AppConfigurationEntry(SayYes.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, emptyMap()) };
        }
    });
    final SshServer server = new SshServer();
    IoHandler ioHandler = new IoHandler() {

        @Override
        public void sessionCreated(IoSession ioSession) throws Exception {
        }

        @Override
        public void sessionClosed(IoSession ioSession) throws Exception {
        }

        @Override
        public void exceptionCaught(IoSession ioSession, Throwable throwable) throws Exception {
        }

        @Override
        public void messageReceived(IoSession ioSession, Readable readable) throws Exception {
        }
    };
    IoProcessor ioProcessor = new IoProcessor() {

        @Override
        public boolean isDisposing() {
            return false;
        }

        @Override
        public boolean isDisposed() {
            return false;
        }

        @Override
        public void dispose() {
        }

        @Override
        public void add(org.apache.mina.core.session.IoSession ioSession) {
        }

        @Override
        public void flush(org.apache.mina.core.session.IoSession ioSession) {
        }

        @Override
        public void write(org.apache.mina.core.session.IoSession ioSession, WriteRequest writeRequest) {
        }

        @Override
        public void updateTrafficControl(org.apache.mina.core.session.IoSession ioSession) {
        }

        @Override
        public void remove(org.apache.mina.core.session.IoSession ioSession) {
        }
    };
    server.setRandomFactory(new SingletonRandomFactory(SecurityUtils.getRandomFactory()));
    this.session = new ServerSessionImpl(server, new MinaSession(new MinaConnector(server, ioHandler, ioProcessor), new DummySession(), SshdSocketAddress.LOCALHOST_ADDRESS));
}
Also used : Configuration(javax.security.auth.login.Configuration) WriteRequest(org.apache.mina.core.write.WriteRequest) SingletonRandomFactory(org.apache.sshd.common.random.SingletonRandomFactory) IoProcessor(org.apache.mina.core.service.IoProcessor) MinaSession(org.apache.sshd.mina.MinaSession) SshServer(org.apache.sshd.server.SshServer) IoHandler(org.apache.sshd.common.io.IoHandler) AppConfigurationEntry(javax.security.auth.login.AppConfigurationEntry) MinaConnector(org.apache.sshd.mina.MinaConnector) ServerSessionImpl(org.apache.sshd.server.session.ServerSessionImpl) Readable(org.apache.sshd.common.util.Readable) DummySession(org.apache.mina.core.session.DummySession) IoSession(org.apache.sshd.common.io.IoSession) Before(org.junit.Before)

Aggregations

AppConfigurationEntry (javax.security.auth.login.AppConfigurationEntry)1 Configuration (javax.security.auth.login.Configuration)1 IoProcessor (org.apache.mina.core.service.IoProcessor)1 DummySession (org.apache.mina.core.session.DummySession)1 WriteRequest (org.apache.mina.core.write.WriteRequest)1 IoHandler (org.apache.sshd.common.io.IoHandler)1 IoSession (org.apache.sshd.common.io.IoSession)1 SingletonRandomFactory (org.apache.sshd.common.random.SingletonRandomFactory)1 Readable (org.apache.sshd.common.util.Readable)1 MinaConnector (org.apache.sshd.mina.MinaConnector)1 MinaSession (org.apache.sshd.mina.MinaSession)1 SshServer (org.apache.sshd.server.SshServer)1 ServerSessionImpl (org.apache.sshd.server.session.ServerSessionImpl)1 Before (org.junit.Before)1