Communicating between Java SSLSocket and HTML5 - java

Just a quick question, can I use SSL in html5 with websockets to communicate with my java server that is using SSLSockets?
I have been trying to connect using another java client using ssl sockets, which works, but I have not tried to do it through html5. Is it even possible?
For the record, I am using github pages to host my server, and I have a custom domain provided by Namecheap and an SSL certificate from Comodo.
Is it even possible to communicate between java and html5 using SSL?

WebSockets are not the same as "normal" TCP sockets but instead a protocol layer on top of TCP. And thus WebSockets over SSL can not communicate directly with SSLSockets. To communicate with WebSockets (with or without SSL) you would need a library implementing the WebSocket protocol.

Related

Java library for SSL/TLS communication

Is there a way to establish the SSL/TLS communication between a Java implementation and some other application? I want my implementation to craft and send the standard protocol communication messages (e.g. ClientHello etc.) and establish a secure connection to the external app by myself.

Creating a Secure Websocket (wss) Server in Java

My main objective is to maintain TLS on a secure website. I'm currently running ws on an https site, the "SSL Lock" in Chrome is appearing red/broken because I am using a non-authenticated source from an https website. I need to secure the WebSocket so that the SSL Lock is preserved.
I've been searching the web for an example of how to implement wss in Java (server) and JavaScript (client), but I can't seem to find anything that I can use. I've seen a few examples of how create an SSL Server (I do have the necessary certificates for a TLS/SSL connection), but I'm not sure how to translate this to wss.
If anyone could provide an example on how to use wss from Java, I would greatly appreciate it.
A secure websocket can use a standard SSL certificate for a web server. You could do this in, for example, Tomcat or use Apache with mod_proxy_wstunnel between the browser and you Java server.

Implement Java proxy server using RMI

We have working on simple definitions and concepts of Distributed Systems in computer networks which are
Replications and Transparency.
so I need to implement RMI client that connects to RMI proxy,then the proxy redirects the client connection to one of n-servers and choose to connect to one of these server based on some value between proxy and server.
so here we have n-servers replications and the client apply the transparency concepts that the client cannot connects directly to servers and from client perspective he can see only one server(proxy server).
Here is simple diagram for what i want to design using RMI only in java...
So, as i have some experience in RMI i implement client and server using RMI
but here Does i need to implement the Proxy server as server to serve the client and as client for the n-servers or what .....????
how to put the first step in implementing proxy using RMI....
Use RMI/IIOP with a load-balancing ORB.

Java RMI and https?

I am new to enterprise design and client server technologies. Can you get Java RMI to work over the HTTPS port 443? I found some google links to stuff about "tunneling" and using HTTP port 80. Does that mean your RMI calls are getting wrapped and then unwrapped on both ends from HTTP protocol?
HTTP tunneling is built into RMI. There is no provision for HTTPS tunneling. It's not a good solution anyway as it imposes a 10x latency.

Can you connect an HTML5 web socket to a Java Socket?

I had set up a system that had a Java program running on a server and a Java applet embedded in a page on a client's browser and the two communicating via Java sockets. I'm wondering if I can switch over from a Java applet to just HTML5 and javascript, using a WebSocket on the client side for communication with the Java socket on the server.
Is there a simple way to make a WebSocket communicate with a Java Socket?
Is there a simple way to make a WebSocket communicate with a Java Socket?
From what I understand, WebSocket works by the client side opening a port 80 connect to the server side, and sending a variant HTTP 1.1 request to the server to negotiate a WebSocket connection. If the server recognizes this, it will send a suitable response, and then allow the still open TCP connection to be used for full-duplex client-server interactions.
It looks like it would be possible to quickly put together a server-side that just understood WebSocket negotation and not full HTTP. However, I think you are better off looking at existing WebSocket implementations, including those embedded in HTTP servers / protocol stacks.
This Wikipedia page compares a number of WebSocket implementations, and should help you in deciding which server-side implementation to use.
But to directly answer your literal question, a WebSocket client can only connect to a WebSocket-aware server; i.e. that one that can perform the initial negotiation. (On the client side, you could implement starting from a bare Socket, but you would need to implement all of the "HTTP stuff" on top of that ... for the setup phase.)
Nope, you cannot communicate using regular sockets with client WebSockets.
WebSockets are special HTTP requests, with an upgrade in the HTTP Header, and a standard protocol to establish a connection (see the official RFC doc).

Categories