code: public <C extends RpcGateway> C getSelfGateway(Class<C> selfGatewayType) {
  		if (selfGatewayType.isInstance(rpcServer)) {
  			@SuppressWarnings("unchecked")
  			C selfGateway = ((C) rpcServer);
  
  			return selfGateway;
  		} else {
  			throw new RuntimeException("RpcEndpoint does not implement the RpcGateway interface of type " + selfGatewayType + '.');
  		}
  	}
docs: Returns a self gateway of the specified type which can be used to issue asynchronous
  calls against the RpcEndpoint.
  
  <p>IMPORTANT: The self gateway type must be implemented by the RpcEndpoint. Otherwise
  the method will fail.
  
  @param selfGatewayType class of the self gateway type
  @param <C> type of the self gateway to create
  @return Self gateway of the specified type which can be used to issue asynchronous rpcs