1111import com .google .gson .Gson ;
1212import com .google .gson .GsonBuilder ;
1313
14- import org .java_websocket .WebSocket ;
15-
1614import java .text .SimpleDateFormat ;
1715import java .util .ArrayList ;
1816import java .util .Date ;
1917import java .util .List ;
2018import java .util .Locale ;
2119
22- import io .reactivex .FlowableTransformer ;
20+ import io .reactivex .CompletableTransformer ;
2321import io .reactivex .android .schedulers .AndroidSchedulers ;
2422import io .reactivex .disposables .Disposable ;
2523import io .reactivex .schedulers .Schedulers ;
@@ -56,7 +54,7 @@ public void disconnectStomp(View view) {
5654 }
5755
5856 public void connectStomp (View view ) {
59- mStompClient = Stomp .over (WebSocket . class , "ws://" + ANDROID_EMULATOR_LOCALHOST
57+ mStompClient = Stomp .over (Stomp . ConnectionProvider . JWS , "ws://" + ANDROID_EMULATOR_LOCALHOST
6058 + ":" + RestClient .SERVER_PORT + "/example-endpoint/websocket" );
6159
6260 mStompClient .lifecycle ()
@@ -91,7 +89,7 @@ public void connectStomp(View view) {
9189 public void sendEchoViaStomp (View v ) {
9290 mStompClient .send ("/topic/hello-msg-mapping" , "Echo STOMP " + mTimeFormat .format (new Date ()))
9391 .compose (applySchedulers ())
94- .subscribe (aVoid -> {
92+ .subscribe (() -> {
9593 Log .d (TAG , "STOMP echo send successfully" );
9694 }, throwable -> {
9795 Log .e (TAG , "Error send STOMP echo" , throwable );
@@ -103,7 +101,7 @@ public void sendEchoViaRest(View v) {
103101 mRestPingDisposable = RestClient .getInstance ().getExampleRepository ()
104102 .sendRestEcho ("Echo REST " + mTimeFormat .format (new Date ()))
105103 .compose (applySchedulers ())
106- .subscribe (aVoid -> {
104+ .subscribe (() -> {
107105 Log .d (TAG , "REST echo send successfully" );
108106 }, throwable -> {
109107 Log .e (TAG , "Error send REST echo" , throwable );
@@ -122,8 +120,8 @@ private void toast(String text) {
122120 Toast .makeText (this , text , Toast .LENGTH_SHORT ).show ();
123121 }
124122
125- protected < T > FlowableTransformer < T , T > applySchedulers () {
126- return tFlowable -> tFlowable
123+ protected CompletableTransformer applySchedulers () {
124+ return upstream -> upstream
127125 .unsubscribeOn (Schedulers .newThread ())
128126 .subscribeOn (Schedulers .io ())
129127 .observeOn (AndroidSchedulers .mainThread ());
0 commit comments