public void Run() { try { MockTlsServer server = new MockTlsServer(); TlsServerProtocol serverProtocol = new TlsServerProtocol(s.GetStream(), secureRandom); serverProtocol.Accept(server); Stream log = new TeeOutputStream(serverProtocol.Stream, stdout); Streams.PipeAll(serverProtocol.Stream, log); serverProtocol.Close(); } finally { try { s.Close(); } catch (IOException) { } finally { } } }
public override async Task CloseAsync() { Console.WriteLine("Starting TCP Channel 2 close action"); if (State == ChannelState.Closed || State == ChannelState.ClosedReceived) { Console.WriteLine("TCP channel 2 is already closed...returning"); return; } State = ChannelState.ClosedReceived; try { if (protocol != null) { protocol.Close(); } } catch { } protocol = null; if (client != null && client.Client != null && (client.Client.Connected && client.Client.Poll(10, SelectMode.SelectRead))) { if (client.Client.UseOnlyOverlappedIO) { client.Client.DuplicateAndClose(Process.GetCurrentProcess().Id); } else { client.Close(); } } client = null; if (readConnection != null) { readConnection.Dispose(); } if (writeConnection != null) { writeConnection.Dispose(); } State = ChannelState.Closed; OnClose?.Invoke(this, new ChannelCloseEventArgs(Id)); await Task.CompletedTask; }
public void Run() { try { MockPskTlsServer server = new MockPskTlsServer(); mServerProtocol.Accept(server); Streams.PipeAll(mServerProtocol.Stream, mServerProtocol.Stream); mServerProtocol.Close(); } catch (Exception) { //throw new RuntimeException(e); } }
public void Run() { try { mServerProtocol.Accept(mServerImpl); Streams.PipeAll(mServerProtocol.Stream, mServerProtocol.Stream); mServerProtocol.Close(); } catch (Exception e) { mCaught = e; mOuter.LogException(mCaught); } WaitExit(); }