What port use stomp protocol? - java

Spring Boot app is hosted on default port server.port=8080 and when I connect to the server, JS client's code calls the same port new SockJS('http://localhost:8080/api/streams'); but port use after connection established for WebSocket?
I suppose data exchange for websocket\stomp work on a different port. But wheat is number?

WebSocket uses the HTTP connection, so it can use that port 8080, or a more normal port 443 (secure) or port 80 (insecure) connection.
A WebSocket connection is established by making an HTTP connection, then asking to upgrade the connection to a WebSocket connection.
As Wikipedia says it:
WebSocket is distinct from HTTP. Both protocols are located at layer 7 in the OSI model and depend on TCP at layer 4. Although they are different, RFC 6455 states that WebSocket "is designed to work over HTTP ports 443 and 80 as well as to support HTTP proxies and intermediaries," thus making it compatible with HTTP. To achieve compatibility, the WebSocket handshake uses the HTTP Upgrade header to change from the HTTP protocol to the WebSocket protocol.

By default there are acceptor elements configured to accept STOMP connections on ports 61616 and 61613.
https://activemq.apache.org/components/artemis/documentation/latest/stomp.html

Related

Java Socket connection getHostName

I am testing on java.net.ServerSocket.
What I want is the following.
When connecting to aaa.com, you get aaa.com,
Getting bbb.com when connecting to bbb.com.
My etc/hosts file configuration is as follows.
127.0.0.1 aaa.com
127.0.0.1 bbb.com
I used the following java source.
ServerSocket server = new ServerSocket(port);
Socket request = server.accept();
request.getInetAddress().getHostName();
And when connecting to aaa.com, aaa.com is returned.
When connecting to bbb.com, aaa.com is returned.
How can I get bbb.com when connected to bbb.com?
This code is not connecting to anything. It is accepting connections from ... something.
So ... I presume that you have some client code (not shown) that is connecting to port port using hostnames "aaa.com" and "bbb.com" respectively. And you want this server side to know which hostname that the client side used.
It is not possible.
The client resolves the hostnames to an IP address and then makes the connection using the IP address (and only the IP address). Since the IP address is the same in both cases, the server side cannot distinguish the two cases.
It follows that if the application level of the server needs to know the hostname that the client used to make the connection, then the application protocol must pass this information from the client to the server. (That is what protocols like HTTP, FTP and so on do.)

Netflix zuul : Configure a TLS pass through HTTP CONNECT calls for outbound proxy server like squid

Problem statement;
I wanted to establish a connection to outer internet through a proxy server. I am using Zuul as gateway which is configured with system parameters like https.proxyHost/https.proxyPort variables with appropriate values, but Zuul is creating a TLS termination connection to proxy server.
How do I configure Zuul to create a Pass through connection so the request would become opaque in proxy server no body should be able to tamper the same.
Any help would be appreciated
Cheers
Anant

Channel binding when connecting in Java to LDAP server - is it possible?

Microsoft has new patch with LDAP connection.
Servers with this patch will not accept connections with no 'channel binding'
My code connects today with 'InitialLdapContext'.
I'm preparing the env and create a new InitialLdapContext.
LDAP/LDAPs working fine.
After this patch,
Will servers reject LDAPs connection?
Will I have to add channel binding handling?
I don't see that InitialLdapContext has channel binding handling.

Measure health of HTTP, HTTPS, SOCKS proxies

I have proxy list, like this. It contains all kind of proxies: HTTP, HTTPS, SOCKS etc. I want to calculate heartbeat (health) of each proxy each X minutes.
I've found nice example how people ping IP addresses through Java sockets:
Socket s = new Socket(hostname, port);
s.getOutputStream().write((byte) '\n');
int ch = s.getInputStream().read();
s.close();
if (ch == '\n') // its all good.
Question
Which protocol (protocols) I need to use to ping HTTP, HTTPS, SOCKS servers?
That code does not use ICMP, it opens a TCP connection to a port.
Opening a TCP connection (or, actually, using ICMP) only verifies that the host network stack is capable of responding, it does not verify the health of the proxy itself. To do that you'd have to actually make a connection using the proxy protocol and verify proxying to an outside resource.

How to get the real client port via IBM HTTP Server

I just have a jsp file, print
request.getRemoteIp();
request.getRemotePort();
And I can get the real client ip, but the port is always wrong.
The Server Environment is IBM Websphere and IBM HTTP Server (IHS60)
From the iptrace, I get the packet data..
From the Client to Server, the port is 13944 to 80 (http port is 80). So the client port is 13944.
Then via HTTP, in the jsp, I invoke an API on another server, the port is 48186 to 9082.
Actually,
request.getRemoteIp(); I really get the client ip.
but
request.getRemotePort(); I get the port number is 48185, it seems be IHS port.
How can I get my real client port, please?
Thanks very much.

Categories