| 92 |
Kevin |
1 |
package ioio.debugger.server;
|
|
|
2 |
|
|
|
3 |
import java.net.InetSocketAddress;
|
|
|
4 |
import java.util.concurrent.Executors;
|
|
|
5 |
|
|
|
6 |
import org.jboss.netty.bootstrap.ServerBootstrap;
|
|
|
7 |
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
|
|
8 |
|
|
|
9 |
public class IOIODebuggerServer {
|
|
|
10 |
|
|
|
11 |
private ServerBootstrap bootstrap;
|
|
|
12 |
private IOIODebuggerServerPipelineFactory pipeline;
|
|
|
13 |
|
|
|
14 |
public IOIODebuggerServer(int port) {
|
|
|
15 |
pipeline = new IOIODebuggerServerPipelineFactory();
|
|
|
16 |
|
|
|
17 |
// Configure the server.
|
|
|
18 |
bootstrap = new ServerBootstrap(
|
|
|
19 |
new NioServerSocketChannelFactory(
|
|
|
20 |
Executors.newCachedThreadPool(),
|
|
|
21 |
Executors.newCachedThreadPool()));
|
|
|
22 |
|
|
|
23 |
// Configure the pipeline factory.
|
|
|
24 |
bootstrap.setPipelineFactory(pipeline);
|
|
|
25 |
|
|
|
26 |
// Bind and start to accept incoming connections.
|
|
|
27 |
bootstrap.bind(new InetSocketAddress(port));
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public IOIODebuggerServerPipelineFactory getPipeline() {
|
|
|
31 |
return pipeline;
|
|
|
32 |
}
|
|
|
33 |
}
|