Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Testing jetty http/3 server

Hello,
I'm learning jetty programming and have a problem with running a basic HTTP/3 server.
Here's what i did: I added http3-server to my project's pom.xml file, added few lines to the main() function:

Server server = new Server();

SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
sslContextFactory.setKeyStorePath("/home/test/keystore.p12");
sslContextFactory.setKeyStorePassword("passwd");
sslContextFactory.setCertAlias("jetty");

Session.Server.Listener sessionListener = new Session.Server.Listener() {};

RawHTTP3ServerConnectionFactory http3 = new RawHTTP3ServerConnectionFactory(sessionListener);
http3.getHTTP3Configuration().setStreamIdleTimeout(15000);

HTTP3ServerConnector connector = new HTTP3ServerConnector(server, sslContextFactory, http3);
connector.getQuicConfiguration().setMaxBidirectionalRemoteStreams(1024);
connector.setPort(8181);

server.addConnector(connector);
server.start();

Now, when server.start() is called i can see messages stating that the server has started:
2022-10-11 09:04:22.670:INFO :oejs.AbstractConnector:main: Started HTTP3ServerConnector@7276c8cd{h3, (h3)}{0.0.0.0:8181}
2022-10-11 09:04:22.891:INFO :oejs.Server:main: Started Server@50de0926{STARTING}[11.0.12,sto=0] @1353ms

However, if i try to make a new connection to it using HTTP3Client class i'm getting java.nio.channels.ClosedChannelException

I'm following this guide: https://www.eclipse.org/jetty/documentation/jetty-11/programming_guide.php
Any suggestions as to what I'm missing here would be very appreciated. For now I want only the client to establish a connection with the h3 server. thanks in advance

Back to the top