com.github.dreamhead.moco.internal.BaseServerRunner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-core Show documentation
Show all versions of moco-core Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.internal;
import com.github.dreamhead.moco.ResponseSetting;
import com.github.dreamhead.moco.Runner;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
public abstract class BaseServerRunner> extends Runner {
protected abstract BaseActualServer serverSetting();
protected abstract ChannelInitializer extends Channel> channelInitializer();
protected final MocoServer server = new MocoServer();
@Override
public void start() {
BaseActualServer server = serverSetting();
int port = this.server.start(server.getPort().or(0), channelInitializer());
server.setPort(port);
}
@Override
public void stop() {
server.stop();
}
}