code: public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) {
          if (vc == null || connType == null) {
              return;
          }
  
          Map<Object, Object> map = vc.getStateMap();
  
          // Internal connections are both inbound and outbound (they're connections
          // to ourselves)
          // so while we prevent setting Outbound ConnTypes for inbound connections
          // and vice versa,
          // we don't prevent internal types from being set as either.
          if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) {
              throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection");
          } else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) {
              throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection");
          }
  
          map.put(CONNECTION_TYPE_VC_KEY, connType);
      }
docs: Set the connection type on the virtual connection. This will overlay
  any preset value.
  
  @param vc
  VirtualConnection containing simple state for this connection
  @param connType
  ConnectionType for the VirtualConnection