Skip to content

Commit

Permalink
fix. FixTcp.OpenAndClose. (macOs | Linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
alec1o committed Jun 30, 2024
1 parent 4a8bf98 commit f349c65
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/tcp/FixTcp.OpenAndClose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public partial class FixTcp(ITestOutputHelper output)
public void OpenAndClose()
{
var host = HostManager.GenerateLocalHost();

Server();

async Task Client()
void Client()
{
TCP.Client client = new();

Expand All @@ -28,7 +28,7 @@ async Task Client()
Assert.False(isModify);
}

await client.To.Open(host);
client.To.Open(host).Wait();

Thread.Sleep(millisecondsTimeout: 30);
{
Expand All @@ -39,7 +39,7 @@ async Task Client()
Assert.False(isError);
}

await client.To.Close();
client.To.Close().Wait();

Thread.Sleep(millisecondsTimeout: 30);
{
Expand All @@ -50,7 +50,7 @@ async Task Client()
Assert.False(isError);
}

await client.To.Open(new Host(IPAddress.Any, 0));
client.To.Open(new Host(IPAddress.Any, 0)).Wait();
{
Assert.False(client.IsOpened);
Assert.True(isModify);
Expand All @@ -59,10 +59,10 @@ async Task Client()
Assert.True(isError);
}

await client.To.Close();
client.To.Close().Wait();
}

async void Server()
void Server()
{
TCP.Server server = new();

Expand All @@ -85,9 +85,9 @@ async void Server()
Assert.False(isModify);
}

await server.To.Open(host);
server.To.Open(host).Wait();

Thread.Sleep(millisecondsTimeout: 10);
Thread.Sleep(millisecondsTimeout: 20);
{
Assert.True(server.IsOpened);
Assert.True(isModify);
Expand All @@ -96,11 +96,11 @@ async void Server()
Assert.False(isError);
}

await Client();
Client();

await server.To.Close();
server.To.Close().Wait();

Thread.Sleep(millisecondsTimeout: 10);
Thread.Sleep(millisecondsTimeout: 20);
{
Assert.False(server.IsOpened);
Assert.True(isModify);
Expand All @@ -110,7 +110,7 @@ async void Server()
}

// Cannot assign requested address
await server.To.Open(new Host("1.1.1.1", 0));
server.To.Open(new Host("1.1.1.1", 0)).Wait();
{
Assert.False(server.IsOpened);
Assert.True(isModify);
Expand All @@ -119,7 +119,7 @@ async void Server()
Assert.True(isError);
}

await server.To.Close();
server.To.Close().Wait();
}
}
}

0 comments on commit f349c65

Please sign in to comment.