equal
deleted
inserted
replaced
22 */ |
22 */ |
23 |
23 |
24 import java.io.Closeable; |
24 import java.io.Closeable; |
25 import java.io.IOException; |
25 import java.io.IOException; |
26 import java.io.UncheckedIOException; |
26 import java.io.UncheckedIOException; |
|
27 import java.net.InetAddress; |
27 import java.net.InetSocketAddress; |
28 import java.net.InetSocketAddress; |
28 import java.net.URI; |
29 import java.net.URI; |
29 import java.nio.ByteBuffer; |
30 import java.nio.ByteBuffer; |
30 import java.nio.CharBuffer; |
31 import java.nio.CharBuffer; |
31 import java.nio.channels.ClosedByInterruptException; |
32 import java.nio.channels.ClosedByInterruptException; |
165 throw new IllegalStateException("Already started"); |
166 throw new IllegalStateException("Already started"); |
166 } |
167 } |
167 ssc = ServerSocketChannel.open(); |
168 ssc = ServerSocketChannel.open(); |
168 try { |
169 try { |
169 ssc.configureBlocking(true); |
170 ssc.configureBlocking(true); |
170 ssc.bind(new InetSocketAddress(0)); |
171 ssc.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); |
171 address = (InetSocketAddress) ssc.getLocalAddress(); |
172 address = (InetSocketAddress) ssc.getLocalAddress(); |
172 thread.start(); |
173 thread.start(); |
173 } catch (IOException e) { |
174 } catch (IOException e) { |
174 close(ssc); |
175 close(ssc); |
175 } |
176 } |