// Path: core/src/main/java/fixio/handlers/FixApplication.java
// public interface FixApplication extends ChannelHandler {
// 
//     /**
//      * Invoked after FIX session was successfully established.
//      *
//      * @param ctx current {@link ChannelHandlerContext}
//      * @param msg {@link LogonEvent} message to handle
//      */
//     void onLogon(ChannelHandlerContext ctx, LogonEvent msg);
// 
//     /**
//      * Invoked after FIX session was closed.
//      *
//      * @param ctx current {@link ChannelHandlerContext}
//      * @param msg {@link LogonEvent} message to handle
//      */
//     void onLogout(ChannelHandlerContext ctx, LogoutEvent msg);
// 
//     /**
//      * Invoked when message arrived
//      *
//      * @param ctx current {@link ChannelHandlerContext}
//      * @param msg a {@link FixMessage} to handle
//      * @param out a {@link List} where decoded messages should be added
//      * @throws BusinessRejectException when message can't be accepted
//      * @throws InterruptedException    if interrupted while processing a message
//      */
//     void onMessage(ChannelHandlerContext ctx, FixMessage msg, List<Object> out)
//             throws BusinessRejectException, InterruptedException;
// 
//     /**
//      * Invoked before {@link FixMessageBuilder} is sent.
//      *
//      * @param ctx            current {@link ChannelHandlerContext}
//      * @param messageBuilder a message builder
//      */
//     void beforeSendMessage(ChannelHandlerContext ctx, FixMessageBuilder messageBuilder);
// }
// 
// Path: core/src/main/java/fixio/netty/pipeline/SessionRepository.java
// public interface SessionRepository {
// 
//     FixSession getOrCreateSession(FixMessageHeader header);
// 
//     FixSession getSession(FixMessageHeader header);
// 
//     void removeSession(SessionId sessionId);
// }
// 
// Path: core/src/main/java/fixio/netty/pipeline/server/FixAcceptorChannelInitializer.java
// public class FixAcceptorChannelInitializer<C extends Channel> extends FixChannelInitializer<C> {
// 
//     private final FixAuthenticator authenticator;
//     private final SessionRepository sessionRepository;
// 
//     public FixAcceptorChannelInitializer(EventLoopGroup workerGroup,
//                                          FixApplication fixApplication,
//                                          FixAuthenticator authenticator,
//                                          SessionRepository sessionRepository) {
//         super(workerGroup, fixApplication);
//         this.authenticator = authenticator;
//         this.sessionRepository = sessionRepository;
//     }
// 
//     @Override
//     protected MessageToMessageCodec<FixMessage, FixMessageBuilder> createSessionHandler() {
//         return new ServerSessionHandler(getFixApplication(), authenticator, sessionRepository);
//     }
// 
// }
// 
// Path: core/src/main/java/fixio/netty/pipeline/server/FixAuthenticator.java
// public interface FixAuthenticator {
// 
//     /**
//      * Verify credentials and returns true if acceptor authorize session initiator.
//      *
//      * @param logonMessage a Logon(35='A') message
//      * @return true if the session acceptor has authenticated the party requesting connection.
//      */
//     boolean authenticate(FixMessage logonMessage);
// }


import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress;
import fixio.handlers.FixApplication;
import fixio.netty.pipeline.SessionRepository;
import fixio.netty.pipeline.server.FixAcceptorChannelInitializer;
import fixio.netty.pipeline.server.FixAuthenticator;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import org.slf4j.Logger;
/*
 * Copyright 2014 The FIX.io Project
 *
 * The FIX.io Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package fixio;



public class FixServer extends AbstractFixConnector {

    private static final Logger LOGGER = LoggerFactory.getLogger(FixServer.class);
    private final int port;
    private Channel channel;
    private EventLoopGroup bossGroup;
    private EventLoopGroup workerGroup;
    private FixAuthenticator authenticator;

    public FixServer(int port,
// Path: core/src/main/java/fixio/handlers/FixApplication.java
// public interface FixApplication extends ChannelHandler {
// 
//     /**
//      * Invoked after FIX session was successfully established.
//      *
//      * @param ctx current {@link ChannelHandlerContext}
//      * @param msg {@link LogonEvent} message to handle
//      */
//     void onLogon(ChannelHandlerContext ctx, LogonEvent msg);
// 
//     /**
//      * Invoked after FIX session was closed.
//      *
//      * @param ctx current {@link ChannelHandlerContext}
//      * @param msg {@link LogonEvent} message to handle
//      */
//     void onLogout(ChannelHandlerContext ctx, LogoutEvent msg);
// 
//     /**
//      * Invoked when message arrived
//      *
//      * @param ctx current {@link ChannelHandlerContext}
//      * @param msg a {@link FixMessage} to handle
//      * @param out a {@link List} where decoded messages should be added
//      * @throws BusinessRejectException when message can't be accepted
//      * @throws InterruptedException    if interrupted while processing a message
//      */
//     void onMessage(ChannelHandlerContext ctx, FixMessage msg, List<Object> out)
//             throws BusinessRejectException, InterruptedException;
// 
//     /**
//      * Invoked before {@link FixMessageBuilder} is sent.
//      *
//      * @param ctx            current {@link ChannelHandlerContext}
//      * @param messageBuilder a message builder
//      */
//     void beforeSendMessage(ChannelHandlerContext ctx, FixMessageBuilder messageBuilder);
// }
// 
// Path: core/src/main/java/fixio/netty/pipeline/SessionRepository.java
// public interface SessionRepository {
// 
//     FixSession getOrCreateSession(FixMessageHeader header);
// 
//     FixSession getSession(FixMessageHeader header);
// 
//     void removeSession(SessionId sessionId);
// }
// 
// Path: core/src/main/java/fixio/netty/pipeline/server/FixAcceptorChannelInitializer.java
// public class FixAcceptorChannelInitializer<C extends Channel> extends FixChannelInitializer<C> {
// 
//     private final FixAuthenticator authenticator;
//     private final SessionRepository sessionRepository;
// 
//     public FixAcceptorChannelInitializer(EventLoopGroup workerGroup,
//                                          FixApplication fixApplication,
//                                          FixAuthenticator authenticator,
//                                          SessionRepository sessionRepository) {
//         super(workerGroup, fixApplication);
//         this.authenticator = authenticator;
//         this.sessionRepository = sessionRepository;
//     }
// 
//     @Override
//     protected MessageToMessageCodec<FixMessage, FixMessageBuilder> createSessionHandler() {
//         return new ServerSessionHandler(getFixApplication(), authenticator, sessionRepository);
//     }
// 
// }
// 
// Path: core/src/main/java/fixio/netty/pipeline/server/FixAuthenticator.java
// public interface FixAuthenticator {
// 
//     /**
//      * Verify credentials and returns true if acceptor authorize session initiator.
//      *
//      * @param logonMessage a Logon(35='A') message
//      * @return true if the session acceptor has authenticated the party requesting connection.
//      */
//     boolean authenticate(FixMessage logonMessage);
// }


// Path: core/src/main/java/fixio/FixServer.java
import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress;
import fixio.handlers.FixApplication;
import fixio.netty.pipeline.SessionRepository;
import fixio.netty.pipeline.server.FixAcceptorChannelInitializer;
import fixio.netty.pipeline.server.FixAuthenticator;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import org.slf4j.Logger;

/*
 * Copyright 2014 The FIX.io Project
 *
 * The FIX.io Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package fixio;



public class FixServer extends AbstractFixConnector {

    private static final Logger LOGGER = LoggerFactory.getLogger(FixServer.class);
    private final int port;
    private Channel channel;
    private EventLoopGroup bossGroup;
    private EventLoopGroup workerGroup;
    private FixAuthenticator authenticator;

    public FixServer(int port,
                     FixApplication fixApplication,