ConnectionBasedLink extends AbstractListenerLink { @Override public long sendCustomMessage(String... messages) throws IOException { ToDeviceMessageCustom msg; synchronized (connection) { msg = addMessageIdIfNeeded(new DefaultToDeviceMessageCustom(messages)); send(this.protocol.toDevice(msg)); } return messageIdOf(msg); } ConnectionBasedLink(Connection connection, Protocol protocol); Connection getConnection(); Protocol getProtocol(); boolean waitForArduinoToBoot(int wait, TimeUnit timeUnit); boolean waitForArduinoToBoot(int wait, TimeUnit timeUnit, final Mode mode); @Override long startListening(Pin pin); @Override long stopListening(Pin pin); @Override long switchAnalogPin(AnalogPin analogPin, int value); @Override long switchDigitalPin(DigitalPin digitalPin, boolean value); @Override long sendKeyPressEvent(char keychar, int keycode, int keylocation, int keymodifiers, int keymodifiersex); @Override long sendTone(Tone tone); @Override long sendNoTone(AnalogPin analogPin); @Override long sendCustomMessage(String... messages); @Override void close();  }
@Test public void canSendCustomMessageSingleValue() throws IOException { String message = "myMessage"; this.link.sendCustomMessage(message); assertThat(toArduinoWasSent(), is("alp: }
@Test public void canSendCustomMessageMultiValue() throws IOException { this.link.sendCustomMessage("1", "2", "3"); assertThat(toArduinoWasSent(), is("alp: }