-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Ali-YousefiTelori/develop
Add support for http listener and improvement performance
- Loading branch information
Showing
11 changed files
with
722 additions
and
330 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
src/CSharp/EasyMicroservices.Laboratory.Tests/Engine/Net/BaseHandler.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/CSharp/EasyMicroservices.Laboratory.Tests/Engine/Net/HttpHandlerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using EasyMicroservice.Laboratory.Tests.Engine.Net; | ||
using EasyMicroservices.Laboratory.Engine; | ||
using EasyMicroservices.Laboratory.Engine.Net; | ||
using EasyMicroservices.Laboratory.Engine.Net.Http; | ||
|
||
namespace EasyMicroservices.Laboratory.Tests.Engine.Net | ||
{ | ||
public class HttpHandlerTest : BaseHandlerTest | ||
{ | ||
protected override BaseHandler GetHandler(ResourceManager resourceManager) | ||
{ | ||
return new HttpHandler(resourceManager); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/CSharp/EasyMicroservices.Laboratory.Tests/Engine/Net/TcpHandlerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using EasyMicroservice.Laboratory.Tests.Engine.Net; | ||
using EasyMicroservices.Laboratory.Engine; | ||
using EasyMicroservices.Laboratory.Engine.Net; | ||
using EasyMicroservices.Laboratory.Engine.Net.Http; | ||
|
||
namespace EasyMicroservices.Laboratory.Tests.Engine.Net | ||
{ | ||
public class TcpHandlerTest : BaseHandlerTest | ||
{ | ||
protected override BaseHandler GetHandler(ResourceManager resourceManager) | ||
{ | ||
return new TcpHandler(resourceManager); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.12</Version> | ||
<Version>0.0.0.13</Version> | ||
<Description>Laboratory of http client.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>test,tests,http,https,httpclient,laboratory</PackageTags> | ||
|
59 changes: 59 additions & 0 deletions
59
src/CSharp/EasyMicroservices.Laboratory/Engine/Net/BaseHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using EasyMicroservices.Laboratory.Constants; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Sockets; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace EasyMicroservices.Laboratory.Engine.Net | ||
{ | ||
/// <summary> | ||
/// Handle the Tcp services | ||
/// </summary> | ||
public abstract class BaseHandler | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public BaseHandler(ResourceManager resourceManager) | ||
{ | ||
_requestHandler = new RequestHandler(resourceManager); | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected readonly RequestHandler _requestHandler; | ||
/// <summary> | ||
/// Start the Tcp listener | ||
/// </summary> | ||
/// <param name="port"></param> | ||
/// <returns></returns> | ||
public abstract Task Start(int port); | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <returns></returns> | ||
public abstract Task<int> Start(); | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public abstract void Stop(); | ||
|
||
|
||
static Random _random = new Random(); | ||
/// <summary> | ||
/// start on any random port | ||
/// </summary> | ||
/// <returns>port to listen</returns> | ||
public int GetRandomPort() | ||
{ | ||
return _random.Next(1111, 9999); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.