equal
deleted
inserted
replaced
37 public static void main(String[] argv) throws Exception { |
37 public static void main(String[] argv) throws Exception { |
38 ByteServer server = new ByteServer(0); |
38 ByteServer server = new ByteServer(0); |
39 // server: accept connection and do nothing |
39 // server: accept connection and do nothing |
40 server.start(); |
40 server.start(); |
41 InetSocketAddress isa = new InetSocketAddress( |
41 InetSocketAddress isa = new InetSocketAddress( |
42 InetAddress.getByName(ByteServer.LOCALHOST), ByteServer.PORT); |
42 InetAddress.getByName(ByteServer.LOCALHOST), server.port()); |
43 Selector sel = Selector.open(); |
43 Selector sel = Selector.open(); |
44 SocketChannel sc = SocketChannel.open(); |
44 SocketChannel sc = SocketChannel.open(); |
45 sc.connect(isa); |
45 sc.connect(isa); |
46 sc.configureBlocking(false); |
46 sc.configureBlocking(false); |
47 sc.register(sel, SelectionKey.OP_WRITE); |
47 sc.register(sel, SelectionKey.OP_WRITE); |