LinkedSocketHint extends SocketHint.SocketHintDecorator { @Override @SuppressWarnings("unchecked") public boolean isCompatibleWith(SocketHint other) { if (connectedType.isPresent()) { return connectedType.get().isAssignableFrom(other.getType()); } else { return getDecorated().isCompatibleWith(other); } } @SuppressWarnings("unchecked")  LinkedSocketHint(InputSocket.Factory inputSocketFactory,
                          OutputSocket.Factory outputSocketFactory); @SuppressWarnings("unchecked") InputSocket<?> linkedInputSocket(String hintIdentifier); @SuppressWarnings("unchecked") OutputSocket linkedOutputSocket(String hintIdentifier); @Override String getTypeLabel(); @Override Class getType(); @Override @SuppressWarnings("unchecked") boolean isCompatibleWith(SocketHint other);  }
@Test public void testConnectingAnyType() { final LinkedSocketHint linkedSocketHint = new LinkedSocketHint(isf, osf); assertTrue("Boolean should be compatible with linkedSocketHint", linkedSocketHint .isCompatibleWith(booleanSocketHint)); assertTrue("Number should be compatible with linkedSocketHint", linkedSocketHint .isCompatibleWith(numberSocketHint)); }