Add getPort() or similar to ServerImpl
See original GitHub issueI noticed that there doesn’t seem to be a way to programatically retrieve a way to get the port a ServerImpl
is listening on. Could we add a method that provides this information?
I would argue it’s useful for when one wants to bind to port 0
i.e.
ServerImpl server = NettyServerBuilder.build();
server.start()
System.out.println("Server listening on port " + server.getPort());
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
java.net.Socket.getPort java code examples - Tabnine
SSLSocket socket = (SSLSocket) sslSocketFactory.createSocket( raw, raw.getInetAddress().getHostAddress(), raw.getPort(), true);
Read more >Inject caller ip address and port not working in Java Jersey ...
getRequestUri().getPort(); ... } The type for the injected object was wrong, I used com.sun.jersey.api.core.HttpContext; instead.
Read more >io.grpc.internal.ServerImpl Maven / Gradle / Ivy - Download JAR files
ServerImpl maven / gradle build tool code. ... private boolean terminated; /** Service encapsulating something similar to an accept() socket.
Read more >Java Map Examples, org.gudy.azureus2.core3.tracker.server.impl ...
Namespace/Package Name: org.gudy.azureus2.core3.tracker.server.impl ... getTime() > CONNECTION_ID_LIFETIME) { return (false); } } boolean ok = data.
Read more >org.subethamail.smtp.server.SMTPServer Java Examples
You can vote up the ones you like or vote down the ones you don't like, ... @Override public void startup() { serverImpl...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any news on the issue? It is super-important for unit-tests. When running unit-tests you need to bind on random port, because otherwize tests occasionally fail giving headaches to developers.
AFAIU, this feature can be implemented easily, it just needs to be decided what API should look like.
I’d prefer
ServerImpl
to havegetPort()
function that returns0
if server is not listening onIP
.I am marking this as closed, even though there may be more followup work for exposing the SocketAddress.