private void handleSubscribe(String[] args){
switch (args[1]) {
case "rr":
    TestSubscriber<Payload> rrsub=new TestSubscriber<>(0L);
  payloadSubscribers.put(args[2],rrsub);
idToType.put(args[2],args[1]);
ReactiveSocket rrclient=createClient.get();
Publisher<Payload> rrpub=rrclient.requestResponse(new PayloadImpl(args[3],args[4]));
rrpub.subscribe(rrsub);
break;
case "rs":
TestSubscriber<Payload> rssub=new TestSubscriber<>(0L);
payloadSubscribers.put(args[2],rssub);
idToType.put(args[2],args[1]);
ReactiveSocket rsclient=createClient.get();
Publisher<Payload> rspub=rsclient.requestStream(new PayloadImpl(args[3],args[4]));
rspub.subscribe(rssub);
break;
case "sub":
TestSubscriber<Payload> rsubsub=new TestSubscriber<>(0L);
payloadSubscribers.put(args[2],rsubsub);
idToType.put(args[2],args[1]);
ReactiveSocket rsubclient=createClient.get();
Publisher<Payload> rsubpub=rsubclient.requestSubscription(new PayloadImpl(args[3],args[4]));
rsubpub.subscribe(rsubsub);
break;
case "fnf":
TestSubscriber<Void> fnfsub=new TestSubscriber<>(0L);
fnfSubscribers.put(args[2],fnfsub);
idToType.put(args[2],args[1]);
ReactiveSocket fnfclient=createClient.get();
Publisher<Void> fnfpub=fnfclient.fireAndForget(new PayloadImpl(args[3],args[4]));
fnfpub.subscribe(fnfsub);
break;
default :
break;
}
}

private void handleSubscribe ( String [ ] args ) { switch ( args [ 1 ] ) { case "rr" : TestSubscriber < Payload > rrsub = new TestSubscriber < > ( 0L ) ; payloadSubscribers . put ( args [ 2 ] , rrsub ) ; idToType . put ( args [ 2 ] , args [ 1 ] ) ; ReactiveSocket rrclient = createClient . get ( ) ; Publisher < Payload > rrpub = rrclient . requestResponse ( new PayloadImpl ( args [ 3 ] , args [ 4 ] ) ) ; rrpub . subscribe ( rrsub ) ; break ; case "rs" : TestSubscriber < Payload > rssub = new TestSubscriber < > ( 0L ) ; payloadSubscribers . put ( args [ 2 ] , rssub ) ; idToType . put ( args [ 2 ] , args [ 1 ] ) ; ReactiveSocket rsclient = createClient . get ( ) ; Publisher < Payload > rspub = rsclient . requestStream ( new PayloadImpl ( args [ 3 ] , args [ 4 ] ) ) ; rspub . subscribe ( rssub ) ; break ; case "sub" : TestSubscriber < Payload > rsubsub = new TestSubscriber < > ( 0L ) ; payloadSubscribers . put ( args [ 2 ] , rsubsub ) ; idToType . put ( args [ 2 ] , args [ 1 ] ) ; ReactiveSocket rsubclient = createClient . get ( ) ; Publisher < Payload > rsubpub = rsubclient . requestSubscription ( new PayloadImpl ( args [ 3 ] , args [ 4 ] ) ) ; rsubpub . subscribe ( rsubsub ) ; break ; case "fnf" : TestSubscriber < Void > fnfsub = new TestSubscriber < > ( 0L ) ; fnfSubscribers . put ( args [ 2 ] , fnfsub ) ; idToType . put ( args [ 2 ] , args [ 1 ] ) ; ReactiveSocket fnfclient = createClient . get ( ) ; Publisher < Void > fnfpub = fnfclient . fireAndForget ( new PayloadImpl ( args [ 3 ] , args [ 4 ] ) ) ; fnfpub . subscribe ( fnfsub ) ; break ; default : break ; } }
this function takes in the arguments for the subscribe command , and subscribes an instance of testsubscriber with an initial request of 0 ( which means don ' t immediately make a request ) to an instance of the corresponding publisher
