All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dreamhead.moco.parser.SocketServerParser Maven / Gradle / Ivy

package com.github.dreamhead.moco.parser;

import com.github.dreamhead.moco.MocoConfig;
import com.github.dreamhead.moco.SocketServer;
import com.github.dreamhead.moco.internal.ActualSocketServer;
import com.github.dreamhead.moco.parser.model.SessionSetting;
import com.google.common.collect.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class SocketServerParser extends BaseParser {
    private static Logger logger = LoggerFactory.getLogger(SocketServerParser.class);

    @Override
    protected SocketServer createServer(final ImmutableList sessionSettings,
                                        final int port, final MocoConfig... configs) {
        SocketServer server = ActualSocketServer.createLogServer(port);
        for (SessionSetting session : sessionSettings) {
            logger.debug("Parse session: {}", session);

            session.bindTo(server);
        }

        return server;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy