@Override public void sendToServer(Protos.TwoWayChannelMessage msg) { wireParser.write(msg); }
@Override public void sendToClient(Protos.TwoWayChannelMessage msg) { socketProtobufHandler.write(msg); }
@Override public void sendToClient(Protos.TwoWayChannelMessage msg) { socketProtobufHandler.write(msg); }
@Override public void sendToServer(Protos.TwoWayChannelMessage msg) { wireParser.write(msg); }
@Override public void sendToServer(Protos.TwoWayChannelMessage msg) { wireParser.write(msg); }
@Override public void sendToClient(Protos.TwoWayChannelMessage msg) { socketProtobufHandler.write(msg); }
@Override public void sendToServer(Protos.TwoWayChannelMessage msg) { wireParser.write(msg); }
@Override public void sendToClient(Protos.TwoWayChannelMessage msg) { socketProtobufHandler.write(msg); }
/** * <p>Closes the channel with the client (will generate a * {@link ServerConnectionEventHandler#channelClosed(PaymentChannelCloseException.CloseReason)} event)</p> * * <p>Note that this does <i>NOT</i> actually broadcast the most recent payment transaction, which will be triggered * automatically when the channel times out by the {@link StoredPaymentChannelServerStates}, or manually by calling * {@link StoredPaymentChannelServerStates#closeChannel(StoredServerChannel)} with the channel returned by * {@link StoredPaymentChannelServerStates#getChannel(org.bitcoinj.core.Sha256Hash)} with the id provided in * {@link ServerConnectionEventHandler#channelOpen(org.bitcoinj.core.Sha256Hash)}</p> */ @SuppressWarnings("unchecked") // The warning 'unchecked call to write(MessageType)' being suppressed here comes from the build() // formally returning MessageLite-derived class that cannot be statically guaranteed to be the same MessageType // that is used in connectionChannel. protected final synchronized void closeChannel() { if (connectionChannel == null) throw new IllegalStateException("Channel is not fully initialized/has already been closed"); connectionChannel.write(Protos.TwoWayChannelMessage.newBuilder() .setType(Protos.TwoWayChannelMessage.MessageType.CLOSE) .build()); connectionChannel.closeConnection(); }
/** * <p>Closes the channel with the client (will generate a * {@link ServerConnectionEventHandler#channelClosed(PaymentChannelCloseException.CloseReason)} event)</p> * * <p>Note that this does <i>NOT</i> actually broadcast the most recent payment transaction, which will be triggered * automatically when the channel times out by the {@link StoredPaymentChannelServerStates}, or manually by calling * {@link StoredPaymentChannelServerStates#closeChannel(StoredServerChannel)} with the channel returned by * {@link StoredPaymentChannelServerStates#getChannel(org.bitcoinj.core.Sha256Hash)} with the id provided in * {@link ServerConnectionEventHandler#channelOpen(org.bitcoinj.core.Sha256Hash)}</p> */ @SuppressWarnings("unchecked") // The warning 'unchecked call to write(MessageType)' being suppressed here comes from the build() // formally returning MessageLite-derived class that cannot be statically guaranteed to be the same MessageType // that is used in connectionChannel. protected final synchronized void closeChannel() { if (connectionChannel == null) throw new IllegalStateException("Channel is not fully initialized/has already been closed"); connectionChannel.write(Protos.TwoWayChannelMessage.newBuilder() .setType(Protos.TwoWayChannelMessage.MessageType.CLOSE) .build()); connectionChannel.closeConnection(); }
/** * <p>Closes the channel with the client (will generate a * {@link ServerConnectionEventHandler#channelClosed(PaymentChannelCloseException.CloseReason)} event)</p> * * <p>Note that this does <i>NOT</i> actually broadcast the most recent payment transaction, which will be triggered * automatically when the channel times out by the {@link StoredPaymentChannelServerStates}, or manually by calling * {@link StoredPaymentChannelServerStates#closeChannel(StoredServerChannel)} with the channel returned by * {@link StoredPaymentChannelServerStates#getChannel(org.bitcoinj.core.Sha256Hash)} with the id provided in * {@link ServerConnectionEventHandler#channelOpen(org.bitcoinj.core.Sha256Hash)}</p> */ @SuppressWarnings("unchecked") // The warning 'unchecked call to write(MessageType)' being suppressed here comes from the build() // formally returning MessageLite-derived class that cannot be statically guaranteed to be the same MessageType // that is used in connectionChannel. protected final synchronized void closeChannel() { if (connectionChannel == null) throw new IllegalStateException("Channel is not fully initialized/has already been closed"); connectionChannel.write(Protos.TwoWayChannelMessage.newBuilder() .setType(Protos.TwoWayChannelMessage.MessageType.CLOSE) .build()); connectionChannel.closeConnection(); }
/** * <p>Closes the channel with the client (will generate a * {@link ServerConnectionEventHandler#channelClosed(PaymentChannelCloseException.CloseReason)} event)</p> * * <p>Note that this does <i>NOT</i> actually broadcast the most recent payment transaction, which will be triggered * automatically when the channel times out by the {@link StoredPaymentChannelServerStates}, or manually by calling * {@link StoredPaymentChannelServerStates#closeChannel(StoredServerChannel)} with the channel returned by * {@link StoredPaymentChannelServerStates#getChannel(org.bitcoinj.core.Sha256Hash)} with the id provided in * {@link ServerConnectionEventHandler#channelOpen(org.bitcoinj.core.Sha256Hash)}</p> */ @SuppressWarnings("unchecked") // The warning 'unchecked call to write(MessageType)' being suppressed here comes from the build() // formally returning MessageLite-derived class that cannot be statically guaranteed to be the same MessageType // that is used in connectionChannel. protected final synchronized void closeChannel() { if (connectionChannel == null) throw new IllegalStateException("Channel is not fully initialized/has already been closed"); connectionChannel.write(Protos.TwoWayChannelMessage.newBuilder() .setType(Protos.TwoWayChannelMessage.MessageType.CLOSE) .build()); connectionChannel.closeConnection(); }
clientHandler.write(msg); assertEquals(msg, clientMessage1Received.get()); assertEquals(msg, clientMessage2Received.get());
clientHandler.write(msg);
.build(); try { clientHandler.write(msg5); } catch (IllegalStateException e) {}