Skip to content

Instantly share code, notes, and snippets.

Created Aug 18, 2019
What would you like to do?
A very simple RSocket client in Java
package com.tpeczek.demo;
import io.rsocket.*;
import io.rsocket.transport.netty.client.TcpClientTransport;
import io.rsocket.util.DefaultPayload;
public class RSocketClient
private static final String PAYLOAD = "[Demo Payload]";
private static final int MAX_ECHOES = 10;
public static void main( String[] args )
System.out.println("-- Demo.RSocket --");
System.out.println("Connecting to RSocket server...");
RSocket socket = RSocketFactory.connect()
.transport(TcpClientTransport.create("", 6000))
System.out.println("Requesting stream...");
System.out.println(" REQUEST PAYLOAD: " + PAYLOAD);
.doOnNext(payload -> System.out.println(" RESPONSE ON NEXT PAYLOAD: " + payload))
.doFinally(signalType -> socket.dispose())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment